{
 "openapi": "3.1.0",
 "info": {
  "title": "Planned Orders (Supply Chain)",
  "version": "20261030b",
  "description": "What the run decided should be ordered, made or moved. A proposal until somebody firms it, and firming one produces a real requisition or works order."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "planned-orders": {
    "type": "object",
    "required": [
     "supply_plan_id",
     "item_id",
     "need_by_date"
    ],
    "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
     },
     "supply_plan_id": {
      "type": "string",
      "format": "uuid",
      "description": "Plan"
     },
     "planned_order_no": {
      "type": "string",
      "description": "Planned order no",
      "readOnly": true
     },
     "item_id": {
      "type": "string",
      "format": "uuid",
      "description": "Item"
     },
     "warehouse_id": {
      "type": "string",
      "format": "uuid",
      "description": "Warehouse"
     },
     "location_id": {
      "type": "string",
      "format": "uuid",
      "description": "Location id"
     },
     "supply_type": {
      "type": "string",
      "description": "How it would be met"
     },
     "quantity": {
      "type": "string",
      "format": "decimal",
      "description": "Quantity"
     },
     "uom_id": {
      "type": "string",
      "format": "uuid",
      "description": "Unit"
     },
     "need_by_date": {
      "type": "string",
      "format": "date",
      "description": "Wanted on"
     },
     "start_date": {
      "type": "string",
      "format": "date",
      "description": "Would have to start"
     },
     "lead_time_days": {
      "type": "string",
      "format": "decimal",
      "description": "Lead time (days)"
     },
     "supplier_id": {
      "type": "string",
      "format": "uuid",
      "description": "Supplier"
     },
     "source_warehouse_id": {
      "type": "string",
      "format": "uuid",
      "description": "Transfer from"
     },
     "work_center_id": {
      "type": "string",
      "format": "uuid",
      "description": "Work center"
     },
     "bom_id": {
      "type": "string",
      "format": "uuid",
      "description": "Bom id"
     },
     "routing_id": {
      "type": "string",
      "format": "uuid",
      "description": "Routing id"
     },
     "unit_cost": {
      "type": "string",
      "format": "decimal",
      "description": "Unit cost"
     },
     "total_cost": {
      "type": "string",
      "format": "decimal",
      "description": "Value"
     },
     "currency": {
      "type": "string",
      "description": "Currency"
     },
     "lot_size_rule": {
      "type": "string",
      "description": "Lot size rule",
      "readOnly": true
     },
     "net_requirement": {
      "type": "string",
      "format": "decimal",
      "description": "Net requirement",
      "readOnly": true
     },
     "rounded_from": {
      "type": "string",
      "format": "decimal",
      "description": "Rounded from",
      "readOnly": true
     },
     "bom_level": {
      "type": "integer",
      "description": "Bom level",
      "readOnly": true
     },
     "parent_planned_order_id": {
      "type": "string",
      "format": "uuid",
      "description": "Parent planned order id",
      "readOnly": true
     },
     "is_firmed": {
      "type": "boolean",
      "description": "Is firmed",
      "readOnly": true
     },
     "firmed_by": {
      "type": "string",
      "format": "uuid",
      "description": "Firmed by",
      "readOnly": true
     },
     "firmed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Firmed at",
      "readOnly": true
     },
     "requisition_id": {
      "type": "string",
      "format": "uuid",
      "description": "Requisition id",
      "readOnly": true
     },
     "purchase_order_id": {
      "type": "string",
      "format": "uuid",
      "description": "Purchase order id",
      "readOnly": true
     },
     "production_order_id": {
      "type": "string",
      "format": "uuid",
      "description": "Production order id",
      "readOnly": true
     },
     "status": {
      "type": "string",
      "description": "Status",
      "readOnly": true
     },
     "notes": {
      "type": "string",
      "description": "Notes"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "config_id": {
      "type": "string",
      "format": "uuid",
      "description": "Config id",
      "readOnly": true
     },
     "sales_order_id": {
      "type": "string",
      "format": "uuid",
      "description": "Sales order id",
      "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
     },
     "reviewed_by": {
      "type": "string",
      "format": "uuid",
      "description": "Reviewed by",
      "readOnly": true
     },
     "reviewed_at": {
      "type": "string",
      "format": "date-time",
      "description": "Reviewed at",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/scm/planned-orders": {
   "get": {
    "summary": "list planned-orders",
    "operationId": "list_planned_orders_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create planned-orders",
    "operationId": "create_planned_orders_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/planned-orders/{id}": {
   "get": {
    "summary": "get planned-orders",
    "operationId": "get_planned_orders_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change planned-orders",
    "operationId": "change_planned_orders_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete planned-orders",
    "operationId": "delete_planned_orders_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/planned-orders/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_planned_orders_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/scm/planned-orders/{id}/firm": {
   "post": {
    "summary": "Firm",
    "operationId": "action_planned_orders_0_6",
    "description": "Body keys: supplierId, notes",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/planned-orders/{id}/review": {
   "post": {
    "summary": "Review",
    "operationId": "action_planned_orders_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/planned-orders/{id}/freeze": {
   "post": {
    "summary": "Freeze",
    "operationId": "action_planned_orders_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}