{"openapi":"3.1.0","info":{"title":"ARS API for Mendix","description":"Endpoints for the Mendix screens of the AI Auto Replenishment System (ARS).\n\n**This is the mock.** It serves a snapshot of the proof of concept (stores XY49, XY62, XY63; today = 2026-09-24) and computes nothing; the structure, rules and error codes are those of the live API. Changes you make are kept until `POST /v1/mock/reset`.\n\nWhen the server requires a key, click **Authorize** and enter it.\n\nScreens and which endpoint feeds which area: [handoff page](/v1/).","version":"1.0.0-mock"},"paths":{"/stores":{"get":{"tags":["Reference"],"summary":"Stores for the store picker","operationId":"listStores","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/Store"},"type":"array","title":"Response Liststores"}}}}},"security":[{"APIKeyHeader":[]}]}},"/data-status":{"get":{"tags":["Reference"],"summary":"Did today's data arrive, per store (data banner)","operationId":"getDataStatus","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Working day, YYYY-MM-DD; leave out for today","title":"Date"},"description":"Working day, YYYY-MM-DD; leave out for today"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tasks":{"get":{"tags":["Tasks"],"summary":"POs overdue, due today and coming up for one store (S1)","operationId":"listTasks","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"store","in":"query","required":true,"schema":{"type":"string","examples":["XY49"],"title":"Store"}},{"name":"date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Working day, YYYY-MM-DD. Leave out for today","title":"Date"},"description":"Working day, YYYY-MM-DD. Leave out for today"},{"name":"type","in":"query","required":false,"schema":{"anyOf":[{"enum":["PO","EM"],"type":"string"},{"type":"null"}],"description":"Only regular (PO) or emergency (EM) orders","title":"Type"},"description":"Only regular (PO) or emergency (EM) orders"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"enum":["draft","approved","exported"],"type":"string"},{"type":"null"}],"title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskList"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Conflict"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/alerts":{"get":{"tags":["Tasks"],"summary":"Emergency orders: stock runs out before the next delivery (S2)","operationId":"listAlerts","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"store","in":"query","required":true,"schema":{"type":"string","examples":["XY49"],"title":"Store"}},{"name":"date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Working day; leave out for today","title":"Date"},"description":"Working day; leave out for today"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertList"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Conflict"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/orders/{id}":{"get":{"tags":["Orders"],"summary":"PO header and lines: AI order, manual formula, reasons, confidence (S3, S4)","operationId":"getOrder","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","title":"Id"}},{"name":"all_articles","in":"query","required":false,"schema":{"type":"boolean","description":"Also the vendor's articles with order 0 ('Show every article')","default":false,"title":"All Articles"},"description":"Also the vendor's articles with order 0 ('Show every article')"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Conflict"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/orders/{id}/lines/{art}":{"put":{"tags":["Orders"],"summary":"Planner changes a quantity (the AI result is never overwritten)","operationId":"changeLine","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","title":"Id"}},{"name":"art","in":"path","required":true,"schema":{"type":"string","title":"Art"}},{"name":"X-User","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Signed-in Mendix user, for the audit log","title":"X-User"},"description":"Signed-in Mendix user, for the audit log"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QtyBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LineChange"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Conflict"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/orders/{id}/approve":{"post":{"tags":["Orders"],"summary":"Approve a PO (draft → approved)","operationId":"approveOrder","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","title":"Id"}},{"name":"X-User","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Signed-in Mendix user, for the audit log","title":"X-User"},"description":"Signed-in Mendix user, for the audit log"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusChange"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Conflict"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/orders/{id}/reopen":{"post":{"tags":["Orders"],"summary":"Reopen an approved PO (approved → draft)","operationId":"reopenOrder","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","title":"Id"}},{"name":"X-User","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Signed-in Mendix user, for the audit log","title":"X-User"},"description":"Signed-in Mendix user, for the audit log"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusChange"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Conflict"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/orders/{id}/reset":{"post":{"tags":["Orders"],"summary":"Undo all the planner's quantity changes on a PO","operationId":"resetOrder","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","title":"Id"}},{"name":"X-User","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Signed-in Mendix user, for the audit log","title":"X-User"},"description":"Signed-in Mendix user, for the audit log"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Order"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Conflict"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/articles/{store}/{art}":{"get":{"tags":["Articles"],"summary":"Sales history, forecast and both calculations for one article (S5)","operationId":"getArticle","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"store","in":"path","required":true,"schema":{"type":"string","title":"Store"}},{"name":"art","in":"path","required":true,"schema":{"type":"string","title":"Art"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Article"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Conflict"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calendar":{"get":{"tags":["Calendar"],"summary":"Holidays, festive periods, promotions and AI tips that touch a month (S8)","operationId":"getCalendar","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"store","in":"query","required":true,"schema":{"type":"string","examples":["XY49"],"title":"Store"}},{"name":"month","in":"query","required":true,"schema":{"type":"string","description":"YYYY-MM","examples":["2026-12"],"title":"Month"},"description":"YYYY-MM"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarList"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Conflict"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/assistant/chat":{"post":{"tags":["Assistant"],"summary":"Question in plain language (S11). Mock: fixed example answer","operationId":"askAssistant","security":[{"APIKeyHeader":[]}],"parameters":[{"name":"X-User","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Signed-in Mendix user, for the audit log","title":"X-User"},"description":"Signed-in Mendix user, for the audit log"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatAnswer"}}}},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Not Found"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Conflict"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/mock/reset":{"post":{"tags":["Mock"],"summary":"Put all test data back (quantities and approvals)","operationId":"resetMock","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Ok"}}}}},"security":[{"APIKeyHeader":[]}]}}},"components":{"schemas":{"Alert":{"properties":{"id":{"type":"string","title":"Id","description":"Emergency PO id; open it with /v1/orders/{id}"},"vendor_id":{"type":"string","title":"Vendor Id"},"vendor_name":{"type":"string","title":"Vendor Name"},"articles":{"type":"integer","title":"Articles"},"value":{"type":"number","title":"Value"},"runs_out":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Runs Out"},"sales_at_risk":{"type":"number","title":"Sales At Risk"},"delivery_date":{"type":"string","title":"Delivery Date"},"status":{"type":"string","enum":["draft","approved","exported"],"title":"Status"}},"type":"object","required":["id","vendor_id","vendor_name","articles","value","runs_out","sales_at_risk","delivery_date","status"],"title":"Alert"},"AlertList":{"properties":{"store":{"type":"string","title":"Store"},"date":{"type":"string","title":"Date"},"count":{"type":"integer","title":"Count"},"alerts":{"items":{"$ref":"#/components/schemas/Alert"},"type":"array","title":"Alerts"}},"type":"object","required":["store","date","count","alerts"],"title":"AlertList"},"Article":{"properties":{"article":{"type":"string","title":"Article"},"description":{"type":"string","title":"Description"},"store":{"type":"string","title":"Store"},"vendor_id":{"type":"string","title":"Vendor Id"},"vendor_name":{"type":"string","title":"Vendor Name"},"department":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Department"},"pack_size":{"type":"number","title":"Pack Size"},"no_suggestion":{"anyOf":[{"type":"string","const":"new_article"},{"type":"null"}],"title":"No Suggestion"},"article_created":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Article Created"},"suggestion":{"additionalProperties":true,"type":"object","title":"Suggestion","examples":[{"qty":12,"reason":"Expected to sell 0.77/day ...","value":209124}]},"facts":{"items":{"$ref":"#/components/schemas/Fact"},"type":"array","title":"Facts"},"buildup":{"items":{"$ref":"#/components/schemas/Step"},"type":"array","title":"Buildup","description":"How the quantity is worked out (S5 table)"},"manual":{"$ref":"#/components/schemas/Manual"},"history":{"$ref":"#/components/schemas/History","description":"Last 91 days, one point per day"},"forecast":{"$ref":"#/components/schemas/Forecast"}},"type":"object","required":["article","description","store","vendor_id","vendor_name","department","pack_size","suggestion","facts","buildup","manual","history","forecast"],"title":"Article"},"CalendarItem":{"properties":{"type":{"type":"string","enum":["public_holiday","joint_leave","retail_day","period","promotion","ai_tip"],"title":"Type","description":"public_holiday, joint_leave, retail_day (payday, Mother's Day …), period (festive season, school holiday), promotion, ai_tip"},"title":{"type":"string","title":"Title"},"start":{"type":"string","title":"Start"},"end":{"type":"string","title":"End"},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail"},"action":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action","description":"ai_tip only: suggested action"}},"type":"object","required":["type","title","start","end","detail"],"title":"CalendarItem"},"CalendarList":{"properties":{"store":{"type":"string","title":"Store"},"month":{"type":"string","title":"Month"},"items":{"items":{"$ref":"#/components/schemas/CalendarItem"},"type":"array","title":"Items","description":"Every item that touches the month, sorted by start date. Multi-day items (periods, promotions) have start < end; show them as bars in a month view"}},"type":"object","required":["store","month","items"],"title":"CalendarList"},"ChatAnswer":{"properties":{"answer":{"type":"string","title":"Answer","description":"Markdown"},"sources":{"items":{"$ref":"#/components/schemas/Source"},"type":"array","title":"Sources"},"mock":{"type":"boolean","title":"Mock","description":"True in the mock: a fixed example answer"}},"type":"object","required":["answer","sources","mock"],"title":"ChatAnswer"},"ChatBody":{"properties":{"question":{"type":"string","title":"Question","examples":["Why does the system suggest ordering 12 of TONG GARDEN CASHEW (37242771)?"]},"history":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"History","description":"Earlier turns: [{role: user|assistant, content}]","default":[]},"store":{"type":"string","title":"Store","examples":["XY49"]},"date":{"type":"string","title":"Date","examples":["2026-09-24"]}},"type":"object","required":["question","store","date"],"title":"ChatBody"},"DataStatus":{"properties":{"date":{"type":"string","title":"Date"},"run_status":{"type":"string","enum":["ok","running","failed"],"title":"Run Status"},"stores":{"items":{"$ref":"#/components/schemas/StoreStatus"},"type":"array","title":"Stores"}},"type":"object","required":["date","run_status","stores"],"title":"DataStatus"},"Error":{"properties":{"code":{"type":"integer","title":"Code"},"message":{"type":"string","title":"Message"}},"type":"object","required":["code","message"],"title":"Error"},"Fact":{"properties":{"label":{"type":"string","title":"Label"},"value":{"anyOf":[{"type":"number"},{"type":"string"},{"type":"null"}],"title":"Value"}},"type":"object","required":["label","value"],"title":"Fact"},"Forecast":{"properties":{"date":{"items":{"type":"string"},"type":"array","title":"Date"},"demand":{"items":{"anyOf":[{"type":"number"},{"type":"null"}]},"type":"array","title":"Demand"},"stock_with_order":{"items":{"anyOf":[{"type":"number"},{"type":"null"}]},"type":"array","title":"Stock With Order"},"arrival":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Arrival"}},"type":"object","required":["date","demand","stock_with_order","arrival"],"title":"Forecast"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"History":{"properties":{"date":{"items":{"type":"string"},"type":"array","title":"Date"},"sales":{"items":{"anyOf":[{"type":"number"},{"type":"null"}]},"type":"array","title":"Sales"},"wholesale":{"items":{"anyOf":[{"type":"number"},{"type":"null"}]},"type":"array","title":"Wholesale"},"stock":{"items":{"anyOf":[{"type":"number"},{"type":"null"}]},"type":"array","title":"Stock"},"out_of_stock":{"items":{"type":"boolean"},"type":"array","title":"Out Of Stock"},"promo":{"items":{"type":"boolean"},"type":"array","title":"Promo"}},"type":"object","required":["date","sales","wholesale","stock","out_of_stock","promo"],"title":"History"},"Line":{"properties":{"article":{"type":"string","title":"Article"},"description":{"type":"string","title":"Description"},"department":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Department"},"pack_size":{"type":"number","title":"Pack Size","description":"Order unit (uom): quantities are always a multiple of it, e.g. 12 → 12, 24, 36. Step − / + by this amount"},"purchase_price":{"type":"number","title":"Purchase Price"},"stock":{"type":"number","title":"Stock"},"on_order":{"type":"number","title":"On Order","description":"Ordered, not received yet"},"normal_per_day":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Normal Per Day","description":"Expected sales per day without the promotion"},"promo_factor":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Promo Factor","description":"Promotion lift applied (×), null when no promotion"},"sales_per_day":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Sales Per Day","description":"Expected sales per day (normal × promotion)"},"expected_sales":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Expected Sales","description":"Expected sales until the next delivery"},"cover_days":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Cover Days"},"safety_stock":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Safety Stock"},"display_stock":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Display Stock"},"vendor_extra":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Vendor Extra","description":"Extra because the vendor often delivers late"},"need":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Need"},"ai_qty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ai Qty","description":"ARS suggestion; never changes. null when ARS cannot suggest (see no_suggestion)"},"no_suggestion":{"anyOf":[{"type":"string","const":"new_article"},{"type":"null"}],"title":"No Suggestion","description":"Why there is no AI quantity: new_article = no sales history yet; the planner enters the quantity"},"article_created":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Article Created","description":"Listing date of a new article"},"planner_qty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Planner Qty","description":"Planner's quantity; null until changed"},"rounded_from":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rounded From","description":"The quantity the planner typed when it was not a multiple of pack_size (qty holds it rounded up). Show the line highlighted: '15 → 24 (pack of 12)'"},"qty":{"type":"number","title":"Qty","description":"Quantity that will be ordered = planner_qty ?? ai_qty ?? 0"},"value":{"type":"number","title":"Value"},"manual":{"anyOf":[{"$ref":"#/components/schemas/Manual"},{"type":"null"}],"description":"Client's manual formula for the same line (S3 'Manual calc' column, S4)"},"promo":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Promo","description":"Short promotion label; null for regular lines"},"promo_detail":{"anyOf":[{"$ref":"#/components/schemas/PromoDetail"},{"type":"null"}],"description":"Details for the promotion pop-up: dates, mechanism, discount, lift"},"confidence":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Confidence"},"check":{"type":"boolean","title":"Check","description":"Show the 'Check' badge"},"reason_short":{"$ref":"#/components/schemas/ReasonShort"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"main_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Main Reason"}},"type":"object","required":["article","description","department","pack_size","purchase_price","stock","on_order","sales_per_day","expected_sales","cover_days","safety_stock","display_stock","vendor_extra","need","ai_qty","planner_qty","qty","value","manual","promo","confidence","check","reason_short","reason","main_reason"],"title":"Line"},"LineChange":{"properties":{"article":{"type":"string","title":"Article"},"ai_qty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ai Qty"},"planner_qty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Planner Qty"},"rounded_from":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rounded From","description":"Typed quantity before rounding up to the pack size, when it was not a multiple"},"qty":{"type":"number","title":"Qty"},"value":{"type":"number","title":"Value"},"header":{"$ref":"#/components/schemas/OrderHeader"}},"type":"object","required":["article","ai_qty","planner_qty","qty","value","header"],"title":"LineChange"},"Manual":{"properties":{"avg_per_day":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Per Day"},"min_stock":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Min Stock","description":"MS in the sheet"},"calc":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Calc","description":"Formula result before rounding"},"qty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Qty"},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Value"}},"type":"object","required":["avg_per_day","min_stock","calc","qty","value"],"title":"Manual"},"Moq":{"properties":{"value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Value","description":"Minimum order value in Rp, if the vendor has one"},"cartons":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Cartons","description":"Minimum number of cartons, if the vendor has one"},"remark":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Remark","description":"The vendor's note in the client's order sheet (REMARKS), as written, e.g. 'MOQ 2jt'"},"current":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Current","description":"Where the PO stands against the minimum: PO value in Rp, or cartons for a carton minimum"},"ok":{"type":"boolean","title":"Ok","description":"The PO total (planner's quantities) meets the minimum, or the vendor has none"},"note":{"type":"string","title":"Note","description":"e.g. 'Below minimum order of Rp 2,000,000'"},"shortfall":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Shortfall","description":"Rp (or cartons) still missing to reach the minimum"},"manual_ok":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Manual Ok","description":"Whether the manual formula's PO would meet the minimum (null when there is no manual order)"},"decision_needed":{"type":"boolean","title":"Decision Needed","description":"True when the PO is below the minimum: the planner must top up or combine with the next order"},"options":{"items":{"$ref":"#/components/schemas/MoqOption"},"type":"array","title":"Options"}},"type":"object","required":["value","cartons","remark","current","ok","note","shortfall","manual_ok","decision_needed","options"],"title":"Moq"},"MoqOption":{"properties":{"action":{"type":"string","enum":["top_up","combine_next"],"title":"Action","description":"top_up: raise quantities until the minimum is met; combine_next: do not order today, add these lines to the next PO"},"label":{"type":"string","title":"Label"},"next_order_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Order Date","description":"combine_next only"}},"type":"object","required":["action","label"],"title":"MoqOption"},"Ok":{"properties":{"ok":{"type":"boolean","title":"Ok"}},"type":"object","required":["ok"],"title":"Ok"},"Order":{"properties":{"header":{"$ref":"#/components/schemas/OrderHeader"},"lines":{"items":{"$ref":"#/components/schemas/Line"},"type":"array","title":"Lines","description":"Regular articles first, then articles on promotion (promo is not null); show them as two sections"}},"type":"object","required":["header","lines"],"title":"Order"},"OrderHeader":{"properties":{"id":{"type":"string","title":"Id"},"po_number":{"type":"string","title":"Po Number"},"type":{"type":"string","enum":["PO","EM"],"title":"Type"},"store":{"type":"string","title":"Store"},"store_name":{"type":"string","title":"Store Name"},"vendor_id":{"type":"string","title":"Vendor Id"},"vendor_name":{"type":"string","title":"Vendor Name"},"variant":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Variant","description":"Order variant from the client's order rules; one PO per store + vendor + variant"},"supply":{"type":"string","enum":["direct","consignment"],"title":"Supply"},"status":{"type":"string","enum":["draft","approved","exported"],"title":"Status"},"order_date":{"type":"string","title":"Order Date"},"delivery_date":{"type":"string","title":"Delivery Date"},"lead_time_days":{"type":"integer","title":"Lead Time Days"},"cycle_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cycle Days"},"articles":{"type":"integer","title":"Articles"},"packs":{"type":"number","title":"Packs"},"value":{"type":"number","title":"Value"},"manual_value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Manual Value","description":"Rp, manual formula on the same PO (only on the sheet day)"},"manual_articles":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Manual Articles"},"moq":{"$ref":"#/components/schemas/Moq"},"vendor_in_time_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Vendor In Time Rate","description":"Share of needed deliveries that arrived in time (0-1)"},"vendor_in_time_period":{"anyOf":[{"$ref":"#/components/schemas/Period"},{"type":"null"}],"description":"The period vendor_in_time_rate is measured over (in production: purchase orders and goods receipts of the last months)"},"lines_edited":{"type":"integer","title":"Lines Edited"},"lines_to_check":{"type":"integer","title":"Lines To Check"},"lines_without_suggestion":{"type":"integer","title":"Lines Without Suggestion","description":"Lines where ARS cannot suggest a quantity (e.g. new articles)"},"estimated":{"type":"boolean","title":"Estimated","description":"True when the store's data was late and the suggestions are estimated"},"approved_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Approved At"}},"type":"object","required":["id","po_number","type","store","store_name","vendor_id","vendor_name","variant","supply","status","order_date","delivery_date","lead_time_days","cycle_days","articles","packs","value","manual_value","manual_articles","moq","vendor_in_time_rate","vendor_in_time_period","lines_edited","lines_to_check","lines_without_suggestion","estimated","approved_at"],"title":"OrderHeader"},"Period":{"properties":{"from":{"type":"string","title":"From","examples":["2026-06-01"]},"to":{"type":"string","title":"To","examples":["2026-09-23"]}},"type":"object","required":["from","to"],"title":"Period"},"PromoDetail":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Promotion name as in the client's plan; null when the lift is seen in sales but not listed"},"program":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Program","description":"e.g. INS, KOREAN FAIR, SMART BUY"},"mechanism":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mechanism","description":"special price, multi-buy, buy x get y …"},"discount_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Discount Pct"},"promo_price":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Promo Price"},"min_qty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Min Qty"},"start":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start"},"end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End"},"uplift":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Uplift","description":"Expected sales lift used in the order, e.g. 1.4 = +40%"},"days_in_cover":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Days In Cover","description":"Promotion days inside this order's cover period"},"source":{"type":"string","title":"Source","description":"plan (client's promotion plan) or sales (lift measured from sales only)"}},"type":"object","required":["name","program","mechanism","discount_pct","promo_price","min_qty","start","end","uplift","days_in_cover","source"],"title":"PromoDetail"},"QtyBody":{"properties":{"qty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Qty","description":"New quantity in pieces. Not a multiple of pack_size → rounded up, and the line returns rounded_from. null = back to the AI quantity","examples":[10]},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note","description":"Optional reason typed by the planner"}},"type":"object","required":["qty"],"title":"QtyBody"},"ReasonShort":{"properties":{"headline":{"type":"string","title":"Headline"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","required":["headline","note"],"title":"ReasonShort"},"Source":{"properties":{"type":{"type":"string","enum":["order","article","vendor"],"title":"Type"},"id":{"type":"string","title":"Id"},"store":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Store"}},"type":"object","required":["type","id"],"title":"Source"},"StatusChange":{"properties":{"id":{"type":"string","title":"Id"},"status":{"type":"string","enum":["draft","approved","exported"],"title":"Status"},"approved_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Approved At"},"approved_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Approved By"}},"type":"object","required":["id","status","approved_at","approved_by"],"title":"StatusChange"},"Step":{"properties":{"label":{"type":"string","title":"Label"},"value":{"type":"number","title":"Value"},"sign":{"type":"integer","enum":[-1,0,1],"title":"Sign","description":"1 adds, -1 subtracts, 0 is a result"}},"type":"object","required":["label","value","sign"],"title":"Step"},"Store":{"properties":{"store":{"type":"string","title":"Store","examples":["XY49"]},"name":{"type":"string","title":"Name","examples":["Dukuh Golf"]}},"type":"object","required":["store","name"],"title":"Store"},"StoreStatus":{"properties":{"store":{"type":"string","title":"Store"},"sales_through":{"type":"string","title":"Sales Through","description":"Last business day with sales loaded"},"stock_through":{"type":"string","title":"Stock Through","description":"Last business day with stock loaded"},"status":{"type":"string","enum":["ok","late","estimated","too_old","recalculated"],"title":"Status","description":"ok · late (still waiting, before the cut-off) · estimated (missing at the cut-off, suggestions estimated) · too_old (older than 2 days, no suggestions) · recalculated (data arrived after the run)"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Text for the banner when status is not ok"}},"type":"object","required":["store","sales_through","stock_through","status"],"title":"StoreStatus"},"Summary":{"properties":{"overdue":{"type":"integer","title":"Overdue"},"due_today":{"type":"integer","title":"Due Today"},"due_today_value":{"type":"number","title":"Due Today Value","description":"Rp, overdue and due today"},"emergency":{"type":"integer","title":"Emergency"},"approved":{"type":"integer","title":"Approved"},"upcoming":{"type":"integer","title":"Upcoming"},"vendors_without_order":{"type":"integer","title":"Vendors Without Order","description":"Vendors due today for which nothing needs ordering"}},"type":"object","required":["overdue","due_today","due_today_value","emergency","approved","upcoming","vendors_without_order"],"title":"Summary"},"Task":{"properties":{"id":{"type":"string","title":"Id","description":"ARS reference of the PO; use it in /v1/orders/{id}","examples":["PO-XY49-13982-B-20260924"]},"po_number":{"type":"string","title":"Po Number","description":"Short number for display","examples":["PO-49-13982-0924-B"]},"type":{"type":"string","enum":["PO","EM"],"title":"Type","description":"PO = regular order, EM = emergency order"},"vendor_id":{"type":"string","title":"Vendor Id"},"vendor_name":{"type":"string","title":"Vendor Name"},"departments":{"items":{"type":"string"},"type":"array","title":"Departments"},"order_date":{"type":"string","title":"Order Date"},"delivery_date":{"type":"string","title":"Delivery Date"},"group":{"type":"string","enum":["overdue","today","done","upcoming"],"title":"Group"},"articles":{"type":"integer","title":"Articles"},"value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Value","description":"Rp; null for upcoming POs that are not calculated yet"},"manual_value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Manual Value","description":"Rp, the client's manual formula for the same PO (only on the sheet day)"},"checks":{"type":"integer","title":"Checks","description":"Lines flagged 'Check' (less certain than usual)"},"moq_ok":{"type":"boolean","title":"Moq Ok"},"moq_note":{"type":"string","title":"Moq Note"},"moq_remark":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Moq Remark","description":"Vendor's MOQ note in the client's order sheet (REMARKS)"},"sales_at_risk":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Sales At Risk","description":"EM only: Rp of sales lost if not ordered now"},"runs_out":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Runs Out","description":"EM only: first day an article runs out"},"status":{"type":"string","enum":["draft","approved","exported"],"title":"Status"},"approved_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Approved At"}},"type":"object","required":["id","po_number","type","vendor_id","vendor_name","departments","order_date","delivery_date","group","articles","value","manual_value","checks","moq_ok","moq_note","moq_remark","status","approved_at"],"title":"Task"},"TaskList":{"properties":{"store":{"type":"string","title":"Store"},"date":{"type":"string","title":"Date"},"summary":{"$ref":"#/components/schemas/Summary"},"tasks":{"items":{"$ref":"#/components/schemas/Task"},"type":"array","title":"Tasks"}},"type":"object","required":["store","date","summary","tasks"],"title":"TaskList"},"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":{"APIKeyHeader":{"type":"apiKey","description":"API key. Required when the server sets ARS_API_KEY (the hosted mock); not needed locally.","in":"header","name":"X-API-Key"}}},"tags":[{"name":"Reference","description":"Stores and data status (store picker, data banner)."},{"name":"Tasks","description":"S1 Purchase orders and S2 Emergency orders."},{"name":"Orders","description":"S3 Purchase order detail and S4 calculation view: read, change quantities, approve."},{"name":"Articles","description":"S5 Article panel."},{"name":"Calendar","description":"S8 Calendar (list of events and AI tips)."},{"name":"Assistant","description":"S11 ARS Assistant."},{"name":"Mock","description":"Only in the mock: reset the test data."}],"servers":[{"url":"/v1"}]}