{
 "openapi": "3.1.0",
 "info": {
  "title": "Nonconformances (Manufacturing)",
  "version": "20261030b",
  "description": "Something is wrong with identified material. Containment before analysis: what is affected, where it is, and whether any of it has already gone to a customer."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "nonconformances": {
    "type": "object",
    "required": [
     "title"
    ],
    "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
     },
     "ncr_no": {
      "type": "string",
      "description": "Ncr no",
      "readOnly": true
     },
     "title": {
      "type": "string",
      "description": "What is wrong"
     },
     "description": {
      "type": "string",
      "description": "Description"
     },
     "found_at_stage": {
      "type": "string",
      "description": "Found at",
      "enum": [
       "incoming",
       "in_process",
       "final",
       "pre_ship",
       "customer",
       "field",
       "audit",
       "storage"
      ]
     },
     "source": {
      "type": "string",
      "description": "Source",
      "enum": [
       "internal",
       "supplier",
       "customer",
       "regulatory",
       "audit"
      ]
     },
     "severity": {
      "type": "string",
      "description": "Severity",
      "enum": [
       "critical",
       "major",
       "minor",
       "cosmetic"
      ]
     },
     "item_id": {
      "type": "string",
      "format": "uuid",
      "description": "Item"
     },
     "lot_no": {
      "type": "string",
      "description": "Lot"
     },
     "serial_no": {
      "type": "string",
      "description": "Serial"
     },
     "quantity_affected": {
      "type": "string",
      "format": "decimal",
      "description": "Quantity affected"
     },
     "quantity_inspected": {
      "type": "string",
      "format": "decimal",
      "description": "Quantity inspected"
     },
     "uom": {
      "type": "string",
      "description": "Unit"
     },
     "production_order_id": {
      "type": "string",
      "format": "uuid",
      "description": "Production order"
     },
     "inspection_id": {
      "type": "string",
      "format": "uuid",
      "description": "Inspection id"
     },
     "batch_record_id": {
      "type": "string",
      "format": "uuid",
      "description": "Batch record id"
     },
     "batch_deviation_id": {
      "type": "string",
      "format": "uuid",
      "description": "Batch deviation id"
     },
     "receipt_id": {
      "type": "string",
      "format": "uuid",
      "description": "Receipt id"
     },
     "supplier_id": {
      "type": "string",
      "format": "uuid",
      "description": "Supplier"
     },
     "customer_id": {
      "type": "string",
      "format": "uuid",
      "description": "Customer"
     },
     "work_center_id": {
      "type": "string",
      "format": "uuid",
      "description": "Work center"
     },
     "equipment_id": {
      "type": "string",
      "format": "uuid",
      "description": "Machine"
     },
     "defect_code_id": {
      "type": "string",
      "format": "uuid",
      "description": "Defect"
     },
     "containment_action": {
      "type": "string",
      "description": "Containment action",
      "readOnly": true
     },
     "contained_at": {
      "type": "string",
      "format": "date-time",
      "description": "Contained at",
      "readOnly": true
     },
     "quantity_quarantined": {
      "type": "string",
      "format": "decimal",
      "description": "Quantity quarantined",
      "readOnly": true
     },
     "quarantine_bin_id": {
      "type": "string",
      "format": "uuid",
      "description": "Quarantine bin id",
      "readOnly": true
     },
     "shipped_quantity": {
      "type": "string",
      "format": "decimal",
      "description": "Shipped quantity",
      "readOnly": true
     },
     "customer_notified": {
      "type": "boolean",
      "description": "Customer notified",
      "readOnly": true
     },
     "recall_required": {
      "type": "boolean",
      "description": "Recall required",
      "readOnly": true
     },
     "disposition": {
      "type": "string",
      "description": "Disposition",
      "readOnly": true
     },
     "disposition_by": {
      "type": "string",
      "format": "uuid",
      "description": "Disposition by",
      "readOnly": true
     },
     "disposition_at": {
      "type": "string",
      "format": "date-time",
      "description": "Disposition at",
      "readOnly": true
     },
     "disposition_justification": {
      "type": "string",
      "description": "Disposition justification",
      "readOnly": true
     },
     "rework_order_id": {
      "type": "string",
      "format": "uuid",
      "description": "Rework order id",
      "readOnly": true
     },
     "cost_material": {
      "type": "string",
      "format": "decimal",
      "description": "Material cost"
     },
     "cost_labor": {
      "type": "string",
      "format": "decimal",
      "description": "Labor cost"
     },
     "cost_total": {
      "type": "string",
      "format": "decimal",
      "description": "Total cost"
     },
     "currency": {
      "type": "string",
      "description": "Currency"
     },
     "journal_id": {
      "type": "string",
      "format": "uuid",
      "description": "Journal id",
      "readOnly": true
     },
     "supplier_chargeback": {
      "type": "string",
      "format": "decimal",
      "description": "Chargeback to supplier"
     },
     "capa_id": {
      "type": "string",
      "format": "uuid",
      "description": "Capa id",
      "readOnly": true
     },
     "raised_by": {
      "type": "string",
      "format": "uuid",
      "description": "Raised by",
      "readOnly": true
     },
     "raised_at": {
      "type": "string",
      "format": "date-time",
      "description": "Raised at",
      "readOnly": true
     },
     "closed_by": {
      "type": "string",
      "format": "uuid",
      "description": "Closed by",
      "readOnly": true
     },
     "closed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Closed at",
      "readOnly": true
     },
     "status": {
      "type": "string",
      "description": "Status",
      "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/nonconformances": {
   "get": {
    "summary": "list nonconformances",
    "operationId": "list_nonconformances_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create nonconformances",
    "operationId": "create_nonconformances_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/nonconformances/{id}": {
   "get": {
    "summary": "get nonconformances",
    "operationId": "get_nonconformances_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change nonconformances",
    "operationId": "change_nonconformances_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete nonconformances",
    "operationId": "delete_nonconformances_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/nonconformances/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_nonconformances_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/nonconformances/{id}/contain": {
   "post": {
    "summary": "Contain",
    "operationId": "action_nonconformances_0_6",
    "description": "Body keys: action*, recallRequired, quantityQuarantined, quarantineBinId",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/nonconformances/{id}/disposition": {
   "post": {
    "summary": "Disposition",
    "operationId": "action_nonconformances_0_6",
    "description": "Body keys: disposition, justification*, raiseCapa; disposition one of use_as_is|rework|regrade|repair|scrap|return_to_supplier",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}