{
 "openapi": "3.1.0",
 "info": {
  "title": "Demand Forecast Lines (Supply Chain)",
  "version": "20261030b",
  "description": "One item, one place, one period. Five quantities, because the statistical number, what sales think, what marketing think, what was agreed and what happened are five different facts."
 },
 "servers": [
  {
   "url": "https://{tenant}.tranxact.ai",
   "variables": {
    "tenant": {
     "default": "demo"
    }
   }
  }
 ],
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer"
   }
  },
  "schemas": {
   "demand-forecasts": {
    "type": "object",
    "required": [
     "plan_id",
     "item_id",
     "period_start",
     "period_end"
    ],
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid",
      "description": "Id",
      "readOnly": true
     },
     "org_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org id",
      "readOnly": true
     },
     "plan_id": {
      "type": "string",
      "format": "uuid",
      "description": "Plan"
     },
     "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"
     },
     "account_id": {
      "type": "string",
      "format": "uuid",
      "description": "Customer"
     },
     "period_start": {
      "type": "string",
      "format": "date",
      "description": "Period from"
     },
     "period_end": {
      "type": "string",
      "format": "date",
      "description": "Period to"
     },
     "period_code": {
      "type": "string",
      "description": "Period code"
     },
     "uom_id": {
      "type": "string",
      "format": "uuid",
      "description": "Unit"
     },
     "history_quantity": {
      "type": "string",
      "format": "decimal",
      "description": "History quantity",
      "readOnly": true
     },
     "statistical_quantity": {
      "type": "string",
      "format": "decimal",
      "description": "Statistical quantity",
      "readOnly": true
     },
     "sales_quantity": {
      "type": "string",
      "format": "decimal",
      "description": "Sales says"
     },
     "marketing_quantity": {
      "type": "string",
      "format": "decimal",
      "description": "Marketing says"
     },
     "consensus_quantity": {
      "type": "string",
      "format": "decimal",
      "description": "Agreed"
     },
     "final_quantity": {
      "type": "string",
      "format": "decimal",
      "description": "Final"
     },
     "actual_quantity": {
      "type": "string",
      "format": "decimal",
      "description": "Actual quantity",
      "readOnly": true
     },
     "lower_bound": {
      "type": "string",
      "format": "decimal",
      "description": "Lower bound",
      "readOnly": true
     },
     "upper_bound": {
      "type": "string",
      "format": "decimal",
      "description": "Upper bound",
      "readOnly": true
     },
     "confidence_pct": {
      "type": "string",
      "format": "decimal",
      "description": "Confidence pct",
      "readOnly": true
     },
     "unit_price": {
      "type": "string",
      "format": "decimal",
      "description": "Unit price"
     },
     "value_amount": {
      "type": "string",
      "format": "decimal",
      "description": "Value amount",
      "readOnly": true
     },
     "currency": {
      "type": "string",
      "description": "Currency"
     },
     "override_reason": {
      "type": "string",
      "description": "Why it was overridden"
     },
     "overridden_by": {
      "type": "string",
      "format": "uuid",
      "description": "Overridden by",
      "readOnly": true
     },
     "overridden_at": {
      "type": "string",
      "format": "date-time",
      "description": "Overridden at",
      "readOnly": true
     },
     "is_promotional": {
      "type": "boolean",
      "description": "Promotional"
     },
     "promotion_ref": {
      "type": "string",
      "description": "Promotion reference"
     },
     "is_new_product": {
      "type": "boolean",
      "description": "New product"
     },
     "is_locked": {
      "type": "boolean",
      "description": "Locked against recalculation"
     },
     "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "Created at",
      "readOnly": true
     },
     "org_unit_id": {
      "type": "string",
      "format": "uuid",
      "description": "Org unit 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
     }
    }
   }
  }
 },
 "security": [
  {
   "bearer": []
  }
 ],
 "paths": {
  "/api/scm/demand-forecasts": {
   "get": {
    "summary": "list demand-forecasts",
    "operationId": "list_demand_forecasts_0_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "post": {
    "summary": "create demand-forecasts",
    "operationId": "create_demand_forecasts_1_4",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/demand-forecasts/{id}": {
   "get": {
    "summary": "get demand-forecasts",
    "operationId": "get_demand_forecasts_0_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "put": {
    "summary": "change demand-forecasts",
    "operationId": "change_demand_forecasts_1_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   },
   "delete": {
    "summary": "delete demand-forecasts",
    "operationId": "delete_demand_forecasts_2_5",
    "responses": {
     "200": {
      "description": "OK"
     },
     "401": {
      "description": "No or bad credential"
     },
     "403": {
      "description": "Not granted"
     },
     "422": {
      "description": "Refused by validation"
     }
    }
   }
  },
  "/api/scm/demand-forecasts/{id}/copy": {
   "post": {
    "summary": "Copy",
    "operationId": "action_demand_forecasts_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"
     }
    }
   }
  }
 }
}