{
 "openapi": "3.1.0",
 "info": {
  "title": "Workflow Adaptations (Manufacturing)",
  "version": "20261030b",
  "description": "Where a standard process was tightened or relaxed for a condition, and what ends it. An adaptation with no expiry is a permanent process change made by an automation, which is exactly what this screen exists to prevent."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "workflow-adaptations": {
    "type": "object",
    "required": [
     "name",
     "process",
     "adaptation",
     "trigger_reason"
    ],
    "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
     },
     "adaptation_no": {
      "type": "string",
      "description": "Adaptation no",
      "readOnly": true
     },
     "name": {
      "type": "string",
      "description": "Name"
     },
     "process": {
      "type": "string",
      "description": "Process",
      "enum": [
       "production_order",
       "quality_inspection",
       "batch_release",
       "change_order",
       "maintenance_order",
       "nonconformance",
       "material_receipt",
       "kanban_replenishment"
      ]
     },
     "scope_item_id": {
      "type": "string",
      "format": "uuid",
      "description": "Item"
     },
     "scope_supplier_id": {
      "type": "string",
      "format": "uuid",
      "description": "Supplier"
     },
     "scope_work_center_id": {
      "type": "string",
      "format": "uuid",
      "description": "Work center"
     },
     "scope_equipment_id": {
      "type": "string",
      "format": "uuid",
      "description": "Machine"
     },
     "scope_rule": {
      "type": "object",
      "description": "Scope rule"
     },
     "adaptation": {
      "type": "string",
      "description": "What it changes",
      "enum": [
       "add_approval",
       "remove_approval",
       "tighten_inspection",
       "relax_inspection",
       "add_step",
       "skip_step",
       "change_sampling",
       "require_signature",
       "escalate_priority",
       "add_hold"
      ]
     },
     "adaptation_payload": {
      "type": "object",
      "description": "Detail"
     },
     "trigger_reason": {
      "type": "string",
      "description": "Why it exists"
     },
     "capa_id": {
      "type": "string",
      "format": "uuid",
      "description": "CAPA"
     },
     "prediction_id": {
      "type": "string",
      "format": "uuid",
      "description": "Prediction id",
      "readOnly": true
     },
     "exit_condition": {
      "type": "string",
      "description": "What ends it"
     },
     "effective_from": {
      "type": "string",
      "format": "date-time",
      "description": "Effective from"
     },
     "expires_at": {
      "type": "string",
      "format": "date-time",
      "description": "Expires"
     },
     "times_applied": {
      "type": "integer",
      "description": "Times applied",
      "readOnly": true
     },
     "proposed_by": {
      "type": "string",
      "description": "Proposed by",
      "readOnly": true
     },
     "approved_by": {
      "type": "string",
      "format": "uuid",
      "description": "Approved by",
      "readOnly": true
     },
     "approved_at": {
      "type": "string",
      "format": "date-time",
      "description": "Approved at",
      "readOnly": true
     },
     "status": {
      "type": "string",
      "description": "Status",
      "readOnly": true
     },
     "revoked_by": {
      "type": "string",
      "format": "uuid",
      "description": "Revoked by",
      "readOnly": true
     },
     "revoked_at": {
      "type": "string",
      "format": "date-time",
      "description": "Revoked at",
      "readOnly": true
     },
     "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/workflow-adaptations": {
   "get": {
    "summary": "list workflow-adaptations",
    "operationId": "list_workflow_adaptations_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create workflow-adaptations",
    "operationId": "create_workflow_adaptations_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/workflow-adaptations/{id}": {
   "get": {
    "summary": "get workflow-adaptations",
    "operationId": "get_workflow_adaptations_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change workflow-adaptations",
    "operationId": "change_workflow_adaptations_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete workflow-adaptations",
    "operationId": "delete_workflow_adaptations_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/workflow-adaptations/active": {
   "get": {
    "summary": "Active",
    "operationId": "action_workflow_adaptations_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/workflow-adaptations/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_workflow_adaptations_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/workflow-adaptations/{id}/approve": {
   "post": {
    "summary": "Approve",
    "operationId": "action_workflow_adaptations_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/workflow-adaptations/{id}/revoke": {
   "post": {
    "summary": "Revoke",
    "operationId": "action_workflow_adaptations_0_6",
    "description": "Body keys: reason*",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}