{
 "openapi": "3.1.0",
 "info": {
  "title": "Batch Records (Manufacturing)",
  "version": "20261030b",
  "description": "What a batch DID, in the order it happened, with every controlled parameter against the specification it was supposed to meet. Review by exception: the counts say whether it can be released without reading two hundred pages."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "batch-records": {
    "type": "object",
    "required": [],
    "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
     },
     "batch_no": {
      "type": "string",
      "description": "Batch no",
      "readOnly": true
     },
     "production_order_id": {
      "type": "string",
      "format": "uuid",
      "description": "Production order id",
      "readOnly": true
     },
     "recipe_id": {
      "type": "string",
      "format": "uuid",
      "description": "Recipe id",
      "readOnly": true
     },
     "recipe_version": {
      "type": "string",
      "description": "Recipe version",
      "readOnly": true
     },
     "item_id": {
      "type": "string",
      "format": "uuid",
      "description": "Item id",
      "readOnly": true
     },
     "lot_no": {
      "type": "string",
      "description": "Lot no",
      "readOnly": true
     },
     "batch_size": {
      "type": "string",
      "format": "decimal",
      "description": "Batch size",
      "readOnly": true
     },
     "qty_produced": {
      "type": "string",
      "format": "decimal",
      "description": "Qty produced",
      "readOnly": true
     },
     "qty_rejected": {
      "type": "string",
      "format": "decimal",
      "description": "Qty rejected",
      "readOnly": true
     },
     "actual_yield_pct": {
      "type": "string",
      "format": "decimal",
      "description": "Actual yield pct",
      "readOnly": true
     },
     "started_at": {
      "type": "string",
      "format": "date-time",
      "description": "Started at",
      "readOnly": true
     },
     "completed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Completed at",
      "readOnly": true
     },
     "expiry_date": {
      "type": "string",
      "format": "date",
      "description": "Expiry date",
      "readOnly": true
     },
     "deviation_count": {
      "type": "integer",
      "description": "Deviation count",
      "readOnly": true
     },
     "out_of_spec_count": {
      "type": "integer",
      "description": "Out of spec count",
      "readOnly": true
     },
     "open_step_count": {
      "type": "integer",
      "description": "Open step count",
      "readOnly": true
     },
     "unsigned_step_count": {
      "type": "integer",
      "description": "Unsigned step count",
      "readOnly": true
     },
     "review_verdict": {
      "type": "string",
      "description": "Review verdict",
      "readOnly": true
     },
     "reviewed_by": {
      "type": "string",
      "format": "uuid",
      "description": "Reviewed by",
      "readOnly": true
     },
     "reviewed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Reviewed at",
      "readOnly": true
     },
     "released_by": {
      "type": "string",
      "format": "uuid",
      "description": "Released by",
      "readOnly": true
     },
     "released_at": {
      "type": "string",
      "format": "date-time",
      "description": "Released at",
      "readOnly": true
     },
     "status": {
      "type": "string",
      "description": "Status",
      "readOnly": true
     },
     "notes": {
      "type": "string",
      "description": "Notes",
      "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/batch-records": {
   "get": {
    "summary": "list batch-records",
    "operationId": "list_batch_records_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Post batch records",
    "operationId": "action_batch_records_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/batch-records/{id}": {
   "get": {
    "summary": "get batch-records",
    "operationId": "get_batch_records_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "Put batch records",
    "operationId": "action_batch_records_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Delete batch records",
    "operationId": "action_batch_records_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/batch-records/{parentId}/steps": {
   "get": {
    "summary": "Steps",
    "operationId": "action_batch_records_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Steps",
    "operationId": "action_batch_records_1_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/batch-records/{parentId}/steps/{lineId}": {
   "put": {
    "summary": "Steps",
    "operationId": "action_batch_records_0_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Steps",
    "operationId": "action_batch_records_1_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/batch-records/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_batch_records_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/batch-records/create": {
   "post": {
    "summary": "Create",
    "operationId": "action_batch_records_0_5",
    "description": "Body keys: productionOrderId, recipeId, lotNo, batchSize",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/batch-records/{id}/sign": {
   "post": {
    "summary": "Sign",
    "operationId": "action_batch_records_0_6",
    "description": "Body keys: meaning, batchStepId, deviationId, role, authMethod, comment; meaning one of performed|verified|reviewed|approved|released|rejected|witnessed; authMethod one of password|sso|pin|badge|biometric",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/batch-records/{id}/review": {
   "get": {
    "summary": "Review",
    "operationId": "action_batch_records_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/mfg/batch-records/{id}/release": {
   "post": {
    "summary": "Release",
    "operationId": "action_batch_records_0_6",
    "description": "Body keys: qtyProduced, qtyRejected, authMethod; authMethod one of password|sso|pin|badge|biometric",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}