{"openapi":"3.1.0","info":{"title":"POST /api/v1/inventory/production/runs/{run_id}/calculate","version":"1.0.0","description":"What-if calculation"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/inventory/production/runs/{run_id}/calculate":{"post":{"tags":["inventory:production"],"summary":"What-if calculation","description":"Recalculate costs without persisting.  Override total_units and/or unit_sale_price.","operationId":"calculate_run_api_v1_inventory_production_runs__run_id__calculate_post","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunCalculateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CostBreakdown"}}}},"404":{"description":"Not Found - Resource does not exist","content":{"application/json":{"example":{"detail":"Resource not found"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"CostBreakdown":{"properties":{"materials_by_category":{"additionalProperties":{"type":"integer"},"type":"object","title":"Materials By Category","description":"Cost per category in cents."},"processing_steps_by_type":{"additionalProperties":{"type":"integer"},"type":"object","title":"Processing Steps By Type","description":"Cost per step_type in cents."},"material_line_items":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Material Line Items"},"step_line_items":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Step Line Items"},"total_cost":{"type":"integer","title":"Total Cost","default":0},"cost_per_unit":{"type":"integer","title":"Cost Per Unit","default":0},"sales_potential":{"type":"integer","title":"Sales Potential","default":0},"gross_profit":{"type":"integer","title":"Gross Profit","default":0},"gross_margin_pct":{"type":"number","title":"Gross Margin Pct","default":0.0},"total_weight":{"type":"number","title":"Total Weight","default":0.0},"total_weight_unit":{"type":"string","title":"Total Weight Unit","default":""}},"type":"object","title":"CostBreakdown","description":"Structured cost breakdown returned by the calculation engine."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"RunCalculateRequest":{"properties":{"total_units":{"anyOf":[{"type":"integer","exclusiveMinimum":0.0},{"type":"null"}],"title":"Total Units"},"unit_sale_price":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Unit Sale Price"}},"type":"object","title":"RunCalculateRequest","description":"For what-if calculations without persisting."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}