{
 "openapi": "3.1.0",
 "info": {
  "title": "Maintenance Plans (Manufacturing)",
  "version": "20261030b",
  "description": "What should be done, how often, and measured how — by calendar, by running hours, by cycles, or by a condition somebody is monitoring. The three are different strategies with different costs."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "maintenance-plans": {
    "type": "object",
    "required": [
     "name"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit id",
      "readOnly": true
     },
     "plan_no": {
      "type": "string",
      "description": "Plan no",
      "readOnly": true
     },
     "name": {
      "type": "string",
      "description": "Name"
     },
     "description": {
      "type": "string",
      "description": "Description"
     },
     "equipment_id": {
      "type": "string",
      "format": "uuid",
      "description": "Machine"
     },
     "equipment_class": {
      "type": "string",
      "description": "Equipment class"
     },
     "work_center_id": {
      "type": "string",
      "format": "uuid",
      "description": "Work center"
     },
     "maintenance_type": {
      "type": "string",
      "description": "Type",
      "enum": [
       "preventive",
       "predictive",
       "condition_based",
       "inspection",
       "lubrication",
       "calibration",
       "statutory",
       "autonomous"
      ]
     },
     "trigger_type": {
      "type": "string",
      "description": "Triggered by",
      "enum": [
       "calendar",
       "meter",
       "condition",
       "event",
       "manual"
      ]
     },
     "interval_days": {
      "type": "integer",
      "description": "Interval (days)"
     },
     "meter_type": {
      "type": "string",
      "description": "Meter",
      "enum": [
       "running_hours",
       "cycles",
       "units_produced",
       "distance",
       "starts"
      ]
     },
     "interval_meter": {
      "type": "string",
      "format": "decimal",
      "description": "Interval (meter units)"
     },
     "condition_rule_id": {
      "type": "string",
      "format": "uuid",
      "description": "Condition rule"
     },
     "lead_days": {
      "type": "integer",
      "description": "Raise the order (days ahead)"
     },
     "requires_shutdown": {
      "type": "boolean",
      "description": "The machine has to stop"
     },
     "estimated_hours": {
      "type": "string",
      "format": "decimal",
      "description": "Estimated hours"
     },
     "estimated_cost": {
      "type": "string",
      "format": "decimal",
      "description": "Estimated cost"
     },
     "currency": {
      "type": "string",
      "description": "Currency"
     },
     "crew_size": {
      "type": "integer",
      "description": "Crew size"
     },
     "trade": {
      "type": "string",
      "description": "Trade"
     },
     "failure_mode_id": {
      "type": "string",
      "format": "uuid",
      "description": "Failure mode it prevents"
     },
     "document_id": {
      "type": "string",
      "format": "uuid",
      "description": "Procedure"
     },
     "last_performed_at": {
      "type": "string",
      "format": "date",
      "description": "Last performed at",
      "readOnly": true
     },
     "last_meter_value": {
      "type": "string",
      "format": "decimal",
      "description": "Last meter value",
      "readOnly": true
     },
     "next_due_date": {
      "type": "string",
      "format": "date",
      "description": "Next due"
     },
     "next_due_meter": {
      "type": "string",
      "format": "decimal",
      "description": "Next due at meter"
     },
     "is_active": {
      "type": "boolean",
      "description": "Active"
     },
     "notes": {
      "type": "string",
      "description": "Notes"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "xf_text_1": {
      "type": "string",
      "description": "Xf text 1",
      "readOnly": true
     },
     "xf_text_2": {
      "type": "string",
      "description": "Xf text 2",
      "readOnly": true
     },
     "xf_text_3": {
      "type": "string",
      "description": "Xf text 3",
      "readOnly": true
     },
     "xf_text_4": {
      "type": "string",
      "description": "Xf text 4",
      "readOnly": true
     },
     "xf_text_5": {
      "type": "string",
      "description": "Xf text 5",
      "readOnly": true
     },
     "xf_num_1": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 1",
      "readOnly": true
     },
     "xf_num_2": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 2",
      "readOnly": true
     },
     "xf_num_3": {
      "type": "string",
      "format": "decimal",
      "description": "Xf num 3",
      "readOnly": true
     },
     "xf_date_1": {
      "type": "string",
      "format": "date",
      "description": "Xf date 1",
      "readOnly": true
     },
     "xf_date_2": {
      "type": "string",
      "format": "date",
      "description": "Xf date 2",
      "readOnly": true
     },
     "created_by": {
      "type": "string",
      "format": "uuid",
      "description": "Created by",
      "readOnly": true
     },
     "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "Updated at",
      "readOnly": true
     },
     "updated_by": {
      "type": "string",
      "format": "uuid",
      "description": "Updated by",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/mfg/maintenance-plans": {
   "get": {
    "summary": "list maintenance-plans",
    "operationId": "list_maintenance_plans_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create maintenance-plans",
    "operationId": "create_maintenance_plans_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/maintenance-plans/{id}": {
   "get": {
    "summary": "get maintenance-plans",
    "operationId": "get_maintenance_plans_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change maintenance-plans",
    "operationId": "change_maintenance_plans_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete maintenance-plans",
    "operationId": "delete_maintenance_plans_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/maintenance-plans/{parentId}/tasks": {
   "get": {
    "summary": "Tasks",
    "operationId": "action_maintenance_plans_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Tasks",
    "operationId": "action_maintenance_plans_1_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/maintenance-plans/{parentId}/tasks/{lineId}": {
   "put": {
    "summary": "Tasks",
    "operationId": "action_maintenance_plans_0_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Tasks",
    "operationId": "action_maintenance_plans_1_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/maintenance-plans/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_maintenance_plans_0_6",
    "description": "Body keys: overrides, preview, withLines",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/maintenance-plans/generate": {
   "post": {
    "summary": "Generate",
    "operationId": "action_maintenance_plans_0_5",
    "description": "Body keys: planId",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}