{
 "openapi": "3.1.0",
 "info": {
  "title": "Supply Plans (Supply Chain)",
  "version": "20261030b",
  "description": "What would have to happen for the demand to be met. An INFINITE run assumes the factory can do whatever the plan asks; a FINITE one does not, and comparing them is exactly how a planner finds the bottleneck."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "supply-plans": {
    "type": "object",
    "required": [
     "name",
     "horizon_from",
     "horizon_to"
    ],
    "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"
     },
     "plan_type": {
      "type": "string",
      "description": "Type",
      "enum": [
       "mrp",
       "mps",
       "drp",
       "rough_cut",
       "simulation",
       "what_if"
      ]
     },
     "capacity_mode": {
      "type": "string",
      "description": "Capacity"
     },
     "scheduling_direction": {
      "type": "string",
      "description": "Scheduled",
      "enum": [
       "forward",
       "backward",
       "bidirectional"
      ]
     },
     "demand_plan_id": {
      "type": "string",
      "format": "uuid",
      "description": "Demand plan"
     },
     "bucket": {
      "type": "string",
      "description": "Grain",
      "enum": [
       "day",
       "week",
       "month"
      ]
     },
     "horizon_from": {
      "type": "string",
      "format": "date",
      "description": "Plan from"
     },
     "horizon_to": {
      "type": "string",
      "format": "date",
      "description": "Plan to"
     },
     "frozen_until": {
      "type": "string",
      "format": "date",
      "description": "Frozen until"
     },
     "warehouse_id": {
      "type": "string",
      "format": "uuid",
      "description": "Warehouse"
     },
     "location_id": {
      "type": "string",
      "format": "uuid",
      "description": "Location"
     },
     "item_category": {
      "type": "string",
      "description": "Category"
     },
     "include_forecast": {
      "type": "boolean",
      "description": "Include the forecast"
     },
     "include_safety_stock": {
      "type": "boolean",
      "description": "Respect safety stock"
     },
     "include_in_transit": {
      "type": "boolean",
      "description": "Count what is already on order"
     },
     "respect_lot_sizing": {
      "type": "boolean",
      "description": "Apply lot sizing"
     },
     "items_planned": {
      "type": "integer",
      "description": "Items planned",
      "readOnly": true
     },
     "orders_proposed": {
      "type": "integer",
      "description": "Orders proposed",
      "readOnly": true
     },
     "orders_firmed": {
      "type": "integer",
      "description": "Orders firmed",
      "readOnly": true
     },
     "exceptions_raised": {
      "type": "integer",
      "description": "Exceptions raised",
      "readOnly": true
     },
     "capacity_overloaded_periods": {
      "type": "integer",
      "description": "Capacity overloaded periods",
      "readOnly": true
     },
     "total_value": {
      "type": "string",
      "format": "decimal",
      "description": "Total value",
      "readOnly": true
     },
     "currency": {
      "type": "string",
      "description": "Currency"
     },
     "run_started_at": {
      "type": "string",
      "format": "date-time",
      "description": "Run started at",
      "readOnly": true
     },
     "run_finished_at": {
      "type": "string",
      "format": "date-time",
      "description": "Run finished at",
      "readOnly": true
     },
     "run_by": {
      "type": "string",
      "format": "uuid",
      "description": "Run by",
      "readOnly": true
     },
     "is_simulation": {
      "type": "boolean",
      "description": "A what-if — may not be firmed"
     },
     "compares_to_id": {
      "type": "string",
      "format": "uuid",
      "description": "Compare against"
     },
     "status": {
      "type": "string",
      "description": "Status",
      "readOnly": true
     },
     "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
     },
     "released_by": {
      "type": "string",
      "format": "uuid",
      "description": "Released by",
      "readOnly": true
     },
     "released_at": {
      "type": "string",
      "format": "date-time",
      "description": "Released at",
      "readOnly": true
     },
     "is_automatic": {
      "type": "boolean",
      "description": "Is automatic",
      "readOnly": true
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/scm/supply-plans": {
   "get": {
    "summary": "list supply-plans",
    "operationId": "list_supply_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 supply-plans",
    "operationId": "create_supply_plans_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/supply-plans/{id}": {
   "get": {
    "summary": "get supply-plans",
    "operationId": "get_supply_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 supply-plans",
    "operationId": "change_supply_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 supply-plans",
    "operationId": "delete_supply_plans_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/supply-plans/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_supply_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/scm/supply-plans/{id}/run": {
   "post": {
    "summary": "Run",
    "operationId": "action_supply_plans_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/supply-plans/{id}/firm-batch": {
   "post": {
    "summary": "Firm batch",
    "operationId": "action_supply_plans_0_6",
    "description": "Body keys: plannedOrderIds, supplyType, throughDate",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/supply-plans/{id}/release": {
   "post": {
    "summary": "Release",
    "operationId": "action_supply_plans_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/supply-plans/{parentId}/orders": {
   "get": {
    "summary": "Orders",
    "operationId": "action_supply_plans_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Orders",
    "operationId": "action_supply_plans_1_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/supply-plans/{parentId}/orders/{lineId}": {
   "put": {
    "summary": "Orders",
    "operationId": "action_supply_plans_0_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Orders",
    "operationId": "action_supply_plans_1_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/supply-plans/{parentId}/exceptions": {
   "get": {
    "summary": "Exceptions",
    "operationId": "action_supply_plans_0_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "Exceptions",
    "operationId": "action_supply_plans_1_6",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/supply-plans/{parentId}/exceptions/{lineId}": {
   "put": {
    "summary": "Exceptions",
    "operationId": "action_supply_plans_0_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "Exceptions",
    "operationId": "action_supply_plans_1_7",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  }
 }
}