{"openapi":"3.0.3","info":{"title":"Acne Studios IMS — Mock API","description":"Mock API server for the Acne Studios Inventory Management System hackathon.\n\n**Authentication:** All endpoints work without authentication (defaults to ADMIN role). To test RBAC, POST to `/api/v1/auth/login` with any seeded user email and password `hackathon2026`.\n\n**Reset data:** POST to `/api/v1/admin/reset` to restore all data to initial seed state.\n\n**Seed info:** GET `/api/v1/admin/seed-info` for all test credentials and sample IDs.","version":"1.0.0","contact":{"name":"Hackathon Support"}},"components":{"schemas":{}},"paths":{"/api/v1/auth/login":{"post":{"summary":"Login with email and password","tags":["Auth"],"description":"Returns a JWT token. All seeded users use password \"hackathon2026\".","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":1}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"role":{"type":"string"},"locationId":{"type":["null","string"]}}}}}}}}}}},"/api/v1/auth/me":{"get":{"summary":"Get current user profile","tags":["Auth"],"description":"Returns the authenticated user profile. Without a token, returns ADMIN.","responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"role":{"type":"string"},"locationId":{"type":["null","string"]},"isActive":{"type":"boolean"}}}}}}}}},"/api/v1/products":{"get":{"summary":"List products","tags":["Products"],"description":"List all products with optional filters for category, gender, season, collection. Supports text search.","parameters":[{"schema":{"type":"string"},"in":"query","name":"category","required":false},{"schema":{"type":"string"},"in":"query","name":"gender","required":false},{"schema":{"type":"string"},"in":"query","name":"season","required":false},{"schema":{"type":"string"},"in":"query","name":"collection","required":false},{"schema":{"type":"boolean"},"in":"query","name":"isCarryOver","required":false},{"schema":{"type":"string"},"in":"query","name":"search","required":false},{"schema":{"type":"number","default":1},"in":"query","name":"page","required":false},{"schema":{"type":"number","default":20},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"styleNumber":{"type":"string"},"name":{"type":"string"},"category":{"type":"string"},"subCategory":{"type":["null","string"]},"gender":{"type":"string"},"season":{"type":"string"},"seasonYear":{"type":"number"},"collection":{"type":["null","string"]},"isCarryOver":{"type":"boolean"},"costPrice":{"type":"number"},"costCurrency":{"type":"string"},"description":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}}}}}}}}}}},"/api/v1/products/{id}":{"get":{"summary":"Get product by ID","tags":["Products"],"description":"Returns product details with all associated SKUs.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"styleNumber":{"type":"string"},"name":{"type":"string"},"category":{"type":"string"},"subCategory":{"type":["null","string"]},"gender":{"type":"string"},"season":{"type":"string"},"seasonYear":{"type":"number"},"collection":{"type":["null","string"]},"isCarryOver":{"type":"boolean"},"costPrice":{"type":"number"},"costCurrency":{"type":"string"},"description":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"skus":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"productId":{"type":"string"},"sku":{"type":"string"},"barcode":{"type":["null","string"]},"colour":{"type":"string"},"colourCode":{"type":"string"},"size":{"type":"string"},"sizeIndex":{"type":"number"},"wholesalePrice":{"type":"number"},"retailPrice":{"type":"number"},"priceCurrency":{"type":"string"},"weight":{"type":["null","number"]},"isActive":{"type":"boolean"}}}}}}}}}}}},"/api/v1/skus":{"get":{"summary":"List SKUs","tags":["Products"],"description":"List all SKUs with optional filters for productId, colour, size.","parameters":[{"schema":{"type":"string"},"in":"query","name":"productId","required":false},{"schema":{"type":"string"},"in":"query","name":"colour","required":false},{"schema":{"type":"string"},"in":"query","name":"size","required":false},{"schema":{"type":"boolean"},"in":"query","name":"isActive","required":false},{"schema":{"type":"string"},"in":"query","name":"search","required":false},{"schema":{"type":"number","default":1},"in":"query","name":"page","required":false},{"schema":{"type":"number","default":50},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"productId":{"type":"string"},"sku":{"type":"string"},"barcode":{"type":["null","string"]},"colour":{"type":"string"},"colourCode":{"type":"string"},"size":{"type":"string"},"sizeIndex":{"type":"number"},"wholesalePrice":{"type":"number"},"retailPrice":{"type":"number"},"priceCurrency":{"type":"string"},"weight":{"type":["null","number"]},"isActive":{"type":"boolean"}}}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}}}}}}}}}}},"/api/v1/admin/health":{"get":{"summary":"Health check","tags":["Admin"],"description":"Returns server status and data statistics.","responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/reset":{"post":{"summary":"Reset all data to seed state","tags":["Admin"],"description":"Restores all collections to their initial seeded values. Useful when hackathon teams want a fresh start.","responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/seed-info":{"get":{"summary":"Get seed data information","tags":["Admin"],"description":"Returns all test user credentials, sample entity IDs, and API documentation links.","responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/latency":{"post":{"summary":"Set simulated response latency","tags":["Admin"],"description":"Set latency by preset (none, fast, realistic, slow) or exact milliseconds. Per-request override available via X-Mock-Latency header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"preset":{"type":"string","enum":["none","fast","realistic","slow"]},"ms":{"type":"number","minimum":0}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/time-travel":{"post":{"summary":"Change the mock server clock","tags":["Admin"],"description":"Set a specific date or advance by N days. Affects seasonal calculations, forecast relevance, and PO delivery timing. Send empty body to reset to real time.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"date":{"type":"string","format":"date-time"},"advanceDays":{"type":"number"}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/simulation":{"get":{"summary":"Get simulation status","tags":["Admin"],"description":"Returns current simulation state: running, events generated, recent event log.","responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/simulation/log":{"get":{"summary":"Get simulation event log","tags":["Admin"],"description":"Returns the full simulation event log with pagination. Events are sorted newest-first.","parameters":[{"schema":{"type":"number","default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"number","default":0},"in":"query","name":"offset","required":false}],"responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/simulation/start":{"post":{"summary":"Start the business day simulation","tags":["Admin"],"description":"Starts generating realistic mock events across all external systems. Requires passphrase \"acne-hackathon-simulate-2026\".\n\n**Options:**\n- `durationHours`: 0.5–720 (default 8). Use 0 for continuous (runs until stopped).\n- `speedMultiplier`: 1–1000 (default 1). Examples: 1=real-time, 10=10x, 60=8h→8min, 500=8h→58sec, 1000=8h→29sec.\n- `autoScenarios`: boolean (default false). When true, random disruptive scenarios are automatically triggered at random intervals during the simulation.\n\n**Presets:** `{ durationHours: 0, speedMultiplier: 100, autoScenarios: true }` = continuous fast stream with random disruptions.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["passphrase"],"properties":{"passphrase":{"type":"string"},"durationHours":{"type":"number","default":8,"minimum":0,"maximum":720,"description":"0 = continuous (runs until manually stopped)"},"speedMultiplier":{"type":"number","default":1,"minimum":1,"maximum":1000,"description":"1 = real-time, 100 = fast stream, 1000 = max speed"},"autoScenarios":{"type":"boolean","default":false,"description":"Auto-trigger random scenarios at random intervals"},"startDate":{"type":"string","description":"ISO datetime to start sim clock from (defaults to now)"}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/simulation/stop":{"post":{"summary":"Stop the business day simulation","tags":["Admin"],"description":"Stops event generation. Requires the passphrase.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["passphrase"],"properties":{"passphrase":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/simulation/scenarios":{"get":{"summary":"List available scenarios","tags":["Admin"],"description":"Returns the full catalog of 16 scenarios that can be activated during a simulation. Each entry includes description, affected business areas, configurable parameters, and defaults.","responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/simulation/scenarios/active":{"get":{"summary":"List currently active scenarios","tags":["Admin"],"description":"Returns all scenarios that are currently running or have been resolved during this simulation session.","responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/simulation/scenarios/activate":{"post":{"summary":"Activate a scenario during simulation","tags":["Admin"],"description":"Starts a scenario that injects disruptive events into the simulation. Requires a running simulation.\n\n**Available scenarios:** VIRAL_PRODUCT, CELEBRITY_ENDORSEMENT, FLASH_SALE_GONE_WRONG, GEOPOLITICAL_DISRUPTION, MARKET_RECESSION, GLOBAL_ECONOMIC_SLOWDOWN, CURRENCY_CRISIS, SUPPLIER_DISRUPTION, LOGISTICS_BOTTLENECK, RAW_MATERIAL_SHORTAGE, QUALITY_CRISIS, COUNTERFEIT_SURGE, WAREHOUSE_OUTAGE, PAYMENT_PROVIDER_OUTAGE, CYBER_INCIDENT, WEATHER_ANOMALY, SEASON_LAUNCH\n\n**Severity levels:** LOW, MEDIUM, HIGH, CRITICAL — controls event frequency and intensity.\n\nAll parameters except passphrase and scenarioId are optional — sensible random values are chosen if omitted.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["passphrase","scenarioId"],"properties":{"passphrase":{"type":"string"},"scenarioId":{"type":"string"},"severity":{"type":"string","enum":["LOW","MEDIUM","HIGH","CRITICAL"]},"durationMinutes":{"type":"number","minimum":1},"market":{"type":"string","description":"ISO country code (e.g., US, FR, JP, CN)"},"region":{"type":"string","enum":["EU","NA","APAC"]},"productId":{"type":"string"},"supplierId":{"type":"string"},"locationId":{"type":"string"},"category":{"type":"string"},"provider":{"type":"string","description":"Payment provider: Adyen or Klarna"},"material":{"type":"string","description":"Raw material name"},"weatherType":{"type":"string","enum":["unseasonably_warm","unseasonably_cold","extreme_heat","prolonged_rain","freak_snowstorm"]},"discountPercent":{"type":"number","minimum":5,"maximum":80}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/simulation/scenarios/{instanceId}/deactivate":{"post":{"summary":"Deactivate a running scenario","tags":["Admin"],"description":"Manually stops a scenario before its natural expiration. Use the instanceId from the activation response.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["passphrase"],"properties":{"passphrase":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"instanceId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/api/v1/export":{"get":{"summary":"List available CSV exports","tags":["Admin"],"description":"Returns the list of entities that can be exported as CSV via /api/v1/export/:entity.csv","responses":{"200":{"description":"Default Response"}}}},"/api/v1/export/{entity}.csv":{"get":{"summary":"Export entity as CSV","tags":["Admin"],"description":"Returns all rows of the specified entity as a downloadable CSV file. See /api/v1/export for the list of available entities.","parameters":[{"schema":{"type":"string"},"in":"path","name":"entity","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/api/v1/export/{entity}.json":{"get":{"summary":"Export entity as JSON","tags":["Admin"],"description":"Returns all rows of the specified entity as a JSON array (not paginated, unlike the standard list endpoints).","parameters":[{"schema":{"type":"string"},"in":"path","name":"entity","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/season-drop":{"post":{"summary":"Trigger a season drop","tags":["Admin"],"description":"Manually launches a new season collection — creates products, SKUs, initial inventory, and purchase orders. Requires passphrase.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["passphrase","season","seasonYear"],"properties":{"passphrase":{"type":"string"},"season":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"seasonYear":{"type":"number","minimum":2025,"maximum":2035},"styleCount":{"type":"number","minimum":5,"maximum":60}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/season-drops":{"get":{"summary":"List all season drops","tags":["Admin"],"description":"Returns history of all season drops (manual, calendar, and seed).","responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/season-drops/{id}":{"get":{"summary":"Get season drop details","tags":["Admin"],"description":"Returns details of a specific season drop including stats.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/season-calendar":{"get":{"summary":"Get the season drop calendar","tags":["Admin"],"description":"Returns the schedule of upcoming and past season drops. Calendar drops fire automatically when the simulation clock or time-travel passes the scheduled date.","responses":{"200":{"description":"Default Response"}}},"post":{"summary":"Add a season drop to the calendar","tags":["Admin"],"description":"Schedules a new season drop. It will auto-fire when simulation or time-travel passes the drop date.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["passphrase","season","seasonYear","dropDate"],"properties":{"passphrase":{"type":"string"},"season":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"seasonYear":{"type":"number","minimum":2025,"maximum":2035},"dropDate":{"type":"string","format":"date","description":"ISO date (YYYY-MM-DD)"},"label":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/season-calendar/{season}/{seasonYear}":{"delete":{"summary":"Remove a season from the drop calendar","tags":["Admin"],"description":"Removes a scheduled season drop. Does not undo drops that already happened.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["passphrase"],"properties":{"passphrase":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"season","required":true},{"schema":{"type":"string"},"in":"path","name":"seasonYear","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/api/v1/admin/season-calendar/check":{"post":{"summary":"Force a calendar drop check","tags":["Admin"],"description":"Checks the calendar against the current mock time and executes any drops that are due. Requires passphrase.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["passphrase"],"properties":{"passphrase":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/api/v1/purchase-orders":{"post":{"summary":"Create a new purchase order","tags":["Purchase Orders"],"description":"Creates a new PO in DRAFT status. Requires supplierId, season, seasonYear, and currency. Generates a sequential PO number in the format PO-{SEASON}{YEAR}-{SEQUENTIAL}.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["supplierId","season","seasonYear","currency"],"properties":{"supplierId":{"type":"string"},"season":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"seasonYear":{"type":"number"},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"expectedDelivery":{"type":"string","format":"date-time"},"deliveryLocationId":{"type":"string"},"shippingTerms":{"type":"string"},"paymentTerms":{"type":"string"},"notes":{"type":"string"}},"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"poNumber":{"type":"string"},"supplierId":{"type":"string"},"season":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"seasonYear":{"type":"number"},"status":{"type":"string","enum":["DRAFT","PENDING_APPROVAL","APPROVED","SENT_TO_SUPPLIER","CONFIRMED_BY_SUPPLIER","IN_PRODUCTION","SHIPPED","PARTIALLY_RECEIVED","RECEIVED","CLOSED","CANCELLED"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"totalAmount":{"type":"number"},"expectedDelivery":{"type":["null","string"]},"actualDelivery":{"type":["null","string"]},"deliveryLocationId":{"type":["null","string"]},"shippingTerms":{"type":["null","string"]},"paymentTerms":{"type":["null","string"]},"notes":{"type":["null","string"]},"createdById":{"type":"string"},"approvedById":{"type":["null","string"]},"approvedAt":{"type":["null","string"]},"sentToSupplierAt":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}},"get":{"summary":"List purchase orders","tags":["Purchase Orders"],"description":"List all purchase orders with optional filters for season, status, supplierId. Supports pagination via page and limit query parameters.","parameters":[{"schema":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"in":"query","name":"season","required":false},{"schema":{"type":"string","enum":["DRAFT","PENDING_APPROVAL","APPROVED","SENT_TO_SUPPLIER","CONFIRMED_BY_SUPPLIER","IN_PRODUCTION","SHIPPED","PARTIALLY_RECEIVED","RECEIVED","CLOSED","CANCELLED"]},"in":"query","name":"status","required":false},{"schema":{"type":"string"},"in":"query","name":"supplierId","required":false},{"schema":{"type":"string"},"in":"query","name":"search","required":false},{"schema":{"type":"number","default":1},"in":"query","name":"page","required":false},{"schema":{"type":"number","default":20},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"poNumber":{"type":"string"},"supplierId":{"type":"string"},"season":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"seasonYear":{"type":"number"},"status":{"type":"string","enum":["DRAFT","PENDING_APPROVAL","APPROVED","SENT_TO_SUPPLIER","CONFIRMED_BY_SUPPLIER","IN_PRODUCTION","SHIPPED","PARTIALLY_RECEIVED","RECEIVED","CLOSED","CANCELLED"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"totalAmount":{"type":"number"},"expectedDelivery":{"type":["null","string"]},"actualDelivery":{"type":["null","string"]},"deliveryLocationId":{"type":["null","string"]},"shippingTerms":{"type":["null","string"]},"paymentTerms":{"type":["null","string"]},"notes":{"type":["null","string"]},"createdById":{"type":"string"},"approvedById":{"type":["null","string"]},"approvedAt":{"type":["null","string"]},"sentToSupplierAt":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}}}}}}}}}}},"/api/v1/purchase-orders/{id}":{"get":{"summary":"Get purchase order details","tags":["Purchase Orders"],"description":"Returns the full purchase order including all line items.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"poNumber":{"type":"string"},"supplierId":{"type":"string"},"season":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"seasonYear":{"type":"number"},"status":{"type":"string","enum":["DRAFT","PENDING_APPROVAL","APPROVED","SENT_TO_SUPPLIER","CONFIRMED_BY_SUPPLIER","IN_PRODUCTION","SHIPPED","PARTIALLY_RECEIVED","RECEIVED","CLOSED","CANCELLED"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"totalAmount":{"type":"number"},"expectedDelivery":{"type":["null","string"]},"actualDelivery":{"type":["null","string"]},"deliveryLocationId":{"type":["null","string"]},"shippingTerms":{"type":["null","string"]},"paymentTerms":{"type":["null","string"]},"notes":{"type":["null","string"]},"createdById":{"type":"string"},"approvedById":{"type":["null","string"]},"approvedAt":{"type":["null","string"]},"sentToSupplierAt":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"purchaseOrderId":{"type":"string"},"skuId":{"type":"string"},"quantityOrdered":{"type":"number"},"quantityReceived":{"type":"number"},"unitCost":{"type":"number"},"lineTotal":{"type":"number"},"expectedDate":{"type":["null","string"]},"notes":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}}}}},"patch":{"summary":"Update a purchase order","tags":["Purchase Orders"],"description":"Update PO header fields (delivery, shipping terms, notes). Only allowed while the PO is in DRAFT status.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"expectedDelivery":{"type":"string","format":"date-time"},"deliveryLocationId":{"type":"string"},"shippingTerms":{"type":"string"},"paymentTerms":{"type":"string"},"notes":{"type":"string"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"poNumber":{"type":"string"},"supplierId":{"type":"string"},"season":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"seasonYear":{"type":"number"},"status":{"type":"string","enum":["DRAFT","PENDING_APPROVAL","APPROVED","SENT_TO_SUPPLIER","CONFIRMED_BY_SUPPLIER","IN_PRODUCTION","SHIPPED","PARTIALLY_RECEIVED","RECEIVED","CLOSED","CANCELLED"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"totalAmount":{"type":"number"},"expectedDelivery":{"type":["null","string"]},"actualDelivery":{"type":["null","string"]},"deliveryLocationId":{"type":["null","string"]},"shippingTerms":{"type":["null","string"]},"paymentTerms":{"type":["null","string"]},"notes":{"type":["null","string"]},"createdById":{"type":"string"},"approvedById":{"type":["null","string"]},"approvedAt":{"type":["null","string"]},"sentToSupplierAt":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}}},"/api/v1/purchase-orders/{id}/lines":{"post":{"summary":"Add a line item","tags":["Purchase Orders"],"description":"Add a new line item to the PO. Only allowed in DRAFT status. Automatically recalculates the PO totalAmount.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["skuId","quantityOrdered","unitCost"],"properties":{"skuId":{"type":"string"},"quantityOrdered":{"type":"number","minimum":1},"unitCost":{"type":"number","minimum":0},"expectedDate":{"type":"string","format":"date-time"},"notes":{"type":"string"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"purchaseOrderId":{"type":"string"},"skuId":{"type":"string"},"quantityOrdered":{"type":"number"},"quantityReceived":{"type":"number"},"unitCost":{"type":"number"},"lineTotal":{"type":"number"},"expectedDate":{"type":["null","string"]},"notes":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}}},"/api/v1/purchase-orders/{id}/lines/{lineId}":{"patch":{"summary":"Update a line item","tags":["Purchase Orders"],"description":"Update quantity, unit cost, or notes on an existing PO line. Only allowed in DRAFT status. Automatically recalculates lineTotal and PO totalAmount.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"quantityOrdered":{"type":"number","minimum":1},"unitCost":{"type":"number","minimum":0},"expectedDate":{"type":"string","format":"date-time"},"notes":{"type":"string"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"lineId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"purchaseOrderId":{"type":"string"},"skuId":{"type":"string"},"quantityOrdered":{"type":"number"},"quantityReceived":{"type":"number"},"unitCost":{"type":"number"},"lineTotal":{"type":"number"},"expectedDate":{"type":["null","string"]},"notes":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}},"delete":{"summary":"Remove a line item","tags":["Purchase Orders"],"description":"Remove a line item from the PO. Only allowed in DRAFT status. Automatically recalculates the PO totalAmount.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true},{"schema":{"type":"string"},"in":"path","name":"lineId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}},"/api/v1/purchase-orders/{id}/submit":{"post":{"summary":"Submit PO for approval","tags":["Purchase Orders"],"description":"Transitions PO from DRAFT to PENDING_APPROVAL. The PO must have at least one line item.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"poNumber":{"type":"string"},"supplierId":{"type":"string"},"season":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"seasonYear":{"type":"number"},"status":{"type":"string","enum":["DRAFT","PENDING_APPROVAL","APPROVED","SENT_TO_SUPPLIER","CONFIRMED_BY_SUPPLIER","IN_PRODUCTION","SHIPPED","PARTIALLY_RECEIVED","RECEIVED","CLOSED","CANCELLED"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"totalAmount":{"type":"number"},"expectedDelivery":{"type":["null","string"]},"actualDelivery":{"type":["null","string"]},"deliveryLocationId":{"type":["null","string"]},"shippingTerms":{"type":["null","string"]},"paymentTerms":{"type":["null","string"]},"notes":{"type":["null","string"]},"createdById":{"type":"string"},"approvedById":{"type":["null","string"]},"approvedAt":{"type":["null","string"]},"sentToSupplierAt":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}}},"/api/v1/purchase-orders/{id}/approve":{"post":{"summary":"Approve a purchase order","tags":["Purchase Orders"],"description":"Transitions PO from PENDING_APPROVAL to APPROVED. Records the approver and approval timestamp.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"poNumber":{"type":"string"},"supplierId":{"type":"string"},"season":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"seasonYear":{"type":"number"},"status":{"type":"string","enum":["DRAFT","PENDING_APPROVAL","APPROVED","SENT_TO_SUPPLIER","CONFIRMED_BY_SUPPLIER","IN_PRODUCTION","SHIPPED","PARTIALLY_RECEIVED","RECEIVED","CLOSED","CANCELLED"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"totalAmount":{"type":"number"},"expectedDelivery":{"type":["null","string"]},"actualDelivery":{"type":["null","string"]},"deliveryLocationId":{"type":["null","string"]},"shippingTerms":{"type":["null","string"]},"paymentTerms":{"type":["null","string"]},"notes":{"type":["null","string"]},"createdById":{"type":"string"},"approvedById":{"type":["null","string"]},"approvedAt":{"type":["null","string"]},"sentToSupplierAt":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}}},"/api/v1/purchase-orders/{id}/reject":{"post":{"summary":"Reject a purchase order","tags":["Purchase Orders"],"description":"Rejects PO and sends it back to DRAFT status. A reason is required and recorded in the status history.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["reason"],"properties":{"reason":{"type":"string","minLength":1}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"poNumber":{"type":"string"},"supplierId":{"type":"string"},"season":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"seasonYear":{"type":"number"},"status":{"type":"string","enum":["DRAFT","PENDING_APPROVAL","APPROVED","SENT_TO_SUPPLIER","CONFIRMED_BY_SUPPLIER","IN_PRODUCTION","SHIPPED","PARTIALLY_RECEIVED","RECEIVED","CLOSED","CANCELLED"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"totalAmount":{"type":"number"},"expectedDelivery":{"type":["null","string"]},"actualDelivery":{"type":["null","string"]},"deliveryLocationId":{"type":["null","string"]},"shippingTerms":{"type":["null","string"]},"paymentTerms":{"type":["null","string"]},"notes":{"type":["null","string"]},"createdById":{"type":"string"},"approvedById":{"type":["null","string"]},"approvedAt":{"type":["null","string"]},"sentToSupplierAt":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}}},"/api/v1/purchase-orders/{id}/send":{"post":{"summary":"Send PO to supplier","tags":["Purchase Orders"],"description":"Transitions PO from APPROVED to SENT_TO_SUPPLIER. Records the sentToSupplierAt timestamp.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"poNumber":{"type":"string"},"supplierId":{"type":"string"},"season":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"seasonYear":{"type":"number"},"status":{"type":"string","enum":["DRAFT","PENDING_APPROVAL","APPROVED","SENT_TO_SUPPLIER","CONFIRMED_BY_SUPPLIER","IN_PRODUCTION","SHIPPED","PARTIALLY_RECEIVED","RECEIVED","CLOSED","CANCELLED"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"totalAmount":{"type":"number"},"expectedDelivery":{"type":["null","string"]},"actualDelivery":{"type":["null","string"]},"deliveryLocationId":{"type":["null","string"]},"shippingTerms":{"type":["null","string"]},"paymentTerms":{"type":["null","string"]},"notes":{"type":["null","string"]},"createdById":{"type":"string"},"approvedById":{"type":["null","string"]},"approvedAt":{"type":["null","string"]},"sentToSupplierAt":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}}},"/api/v1/purchase-orders/{id}/confirm":{"post":{"summary":"Supplier confirms PO","tags":["Purchase Orders"],"description":"Transitions PO from SENT_TO_SUPPLIER to CONFIRMED_BY_SUPPLIER. Typically called by a user with the SUPPLIER role.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"poNumber":{"type":"string"},"supplierId":{"type":"string"},"season":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"seasonYear":{"type":"number"},"status":{"type":"string","enum":["DRAFT","PENDING_APPROVAL","APPROVED","SENT_TO_SUPPLIER","CONFIRMED_BY_SUPPLIER","IN_PRODUCTION","SHIPPED","PARTIALLY_RECEIVED","RECEIVED","CLOSED","CANCELLED"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"totalAmount":{"type":"number"},"expectedDelivery":{"type":["null","string"]},"actualDelivery":{"type":["null","string"]},"deliveryLocationId":{"type":["null","string"]},"shippingTerms":{"type":["null","string"]},"paymentTerms":{"type":["null","string"]},"notes":{"type":["null","string"]},"createdById":{"type":"string"},"approvedById":{"type":["null","string"]},"approvedAt":{"type":["null","string"]},"sentToSupplierAt":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}}},"/api/v1/purchase-orders/{id}/receive":{"post":{"summary":"Record goods receipt","tags":["Purchase Orders"],"description":"Record receipt of goods against PO lines. Creates POReceipt records, updates quantityReceived on each line, and transitions the PO status to PARTIALLY_RECEIVED or RECEIVED based on total quantities.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["lines"],"properties":{"lines":{"type":"array","minItems":1,"items":{"type":"object","required":["poLineId","quantityReceived"],"properties":{"poLineId":{"type":"string"},"quantityReceived":{"type":"number","minimum":0},"qualityStatus":{"type":"string","default":"ACCEPTED"},"damagedQuantity":{"type":"number","default":0},"notes":{"type":"string"}},"additionalProperties":false}},"locationId":{"type":"string"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"purchaseOrder":{"type":"object","properties":{"id":{"type":"string"},"poNumber":{"type":"string"},"supplierId":{"type":"string"},"season":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"seasonYear":{"type":"number"},"status":{"type":"string","enum":["DRAFT","PENDING_APPROVAL","APPROVED","SENT_TO_SUPPLIER","CONFIRMED_BY_SUPPLIER","IN_PRODUCTION","SHIPPED","PARTIALLY_RECEIVED","RECEIVED","CLOSED","CANCELLED"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"totalAmount":{"type":"number"},"expectedDelivery":{"type":["null","string"]},"actualDelivery":{"type":["null","string"]},"deliveryLocationId":{"type":["null","string"]},"shippingTerms":{"type":["null","string"]},"paymentTerms":{"type":["null","string"]},"notes":{"type":["null","string"]},"createdById":{"type":"string"},"approvedById":{"type":["null","string"]},"approvedAt":{"type":["null","string"]},"sentToSupplierAt":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}},"receipts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"poLineId":{"type":"string"},"quantityReceived":{"type":"number"},"receivedAt":{"type":"string"},"receivedById":{"type":"string"},"locationId":{"type":"string"},"qualityStatus":{"type":"string"},"damagedQuantity":{"type":"number"},"notes":{"type":["null","string"]}}}}}}}}}}}},"/api/v1/purchase-orders/{id}/cancel":{"post":{"summary":"Cancel a purchase order","tags":["Purchase Orders"],"description":"Cancel the PO. Allowed from any status except RECEIVED and CLOSED. An optional reason can be provided.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"poNumber":{"type":"string"},"supplierId":{"type":"string"},"season":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"seasonYear":{"type":"number"},"status":{"type":"string","enum":["DRAFT","PENDING_APPROVAL","APPROVED","SENT_TO_SUPPLIER","CONFIRMED_BY_SUPPLIER","IN_PRODUCTION","SHIPPED","PARTIALLY_RECEIVED","RECEIVED","CLOSED","CANCELLED"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"totalAmount":{"type":"number"},"expectedDelivery":{"type":["null","string"]},"actualDelivery":{"type":["null","string"]},"deliveryLocationId":{"type":["null","string"]},"shippingTerms":{"type":["null","string"]},"paymentTerms":{"type":["null","string"]},"notes":{"type":["null","string"]},"createdById":{"type":"string"},"approvedById":{"type":["null","string"]},"approvedAt":{"type":["null","string"]},"sentToSupplierAt":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}}},"/api/v1/purchase-orders/{id}/history":{"get":{"summary":"Get PO status history","tags":["Purchase Orders"],"description":"Returns the full status transition history for a purchase order, sorted chronologically.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"purchaseOrderId":{"type":"string"},"fromStatus":{"type":["null","string"]},"toStatus":{"type":"string","enum":["DRAFT","PENDING_APPROVAL","APPROVED","SENT_TO_SUPPLIER","CONFIRMED_BY_SUPPLIER","IN_PRODUCTION","SHIPPED","PARTIALLY_RECEIVED","RECEIVED","CLOSED","CANCELLED"]},"changedById":{"type":"string"},"reason":{"type":["null","string"]},"changedAt":{"type":"string"}}}}}}}}}},"/api/v1/inventory/availability":{"get":{"summary":"Check stock availability","tags":["Inventory"],"description":"Check available stock by SKU, location, or region. Available = OnHand - Allocated + InTransit. All filters are optional and can be combined.","parameters":[{"schema":{"type":"string"},"in":"query","name":"skuId","required":false},{"schema":{"type":"string"},"in":"query","name":"locationId","required":false},{"schema":{"type":"string"},"in":"query","name":"region","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"skuId":{"type":"string"},"locationId":{"type":"string"},"locationName":{"type":"string"},"region":{"type":"string"},"quantityOnHand":{"type":"number"},"quantityAllocated":{"type":"number"},"quantityInTransit":{"type":"number"},"available":{"type":"number"}}}}}}}}}}}},"/api/v1/inventory/levels":{"get":{"summary":"List stock levels","tags":["Inventory"],"description":"Returns stock levels with optional filters for skuId, locationId, and belowReorderPoint. Use belowReorderPoint=true to find items that need replenishment.","parameters":[{"schema":{"type":"string"},"in":"query","name":"skuId","required":false},{"schema":{"type":"string"},"in":"query","name":"locationId","required":false},{"schema":{"type":"boolean"},"in":"query","name":"belowReorderPoint","required":false},{"schema":{"type":"number","default":1},"in":"query","name":"page","required":false},{"schema":{"type":"number","default":20},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"skuId":{"type":"string"},"locationId":{"type":"string"},"quantityOnHand":{"type":"number"},"quantityAllocated":{"type":"number"},"quantityInTransit":{"type":"number"},"quantityOnOrder":{"type":"number"},"reorderPoint":{"type":["null","number"]},"reorderQuantity":{"type":["null","number"]},"lastCountedAt":{"type":["null","string"]},"updatedAt":{"type":"string"}}}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}}}}}}}}}}},"/api/v1/inventory/transfer":{"post":{"summary":"Initiate inter-location stock transfer","tags":["Inventory"],"description":"Transfers stock between locations. Decreases quantityOnHand at source, increases quantityInTransit at destination, and creates TRANSFER_OUT and TRANSFER_IN movement records.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["skuId","fromLocationId","toLocationId","quantity"],"properties":{"skuId":{"type":"string"},"fromLocationId":{"type":"string"},"toLocationId":{"type":"string"},"quantity":{"type":"number","minimum":1},"reason":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"transfer":{"type":"object","properties":{"skuId":{"type":"string"},"fromLocationId":{"type":"string"},"toLocationId":{"type":"string"},"quantity":{"type":"number"},"movements":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"skuId":{"type":"string"},"type":{"type":"string"},"quantity":{"type":"number"},"fromLocationId":{"type":["null","string"]},"toLocationId":{"type":["null","string"]},"referenceType":{"type":["null","string"]},"referenceId":{"type":["null","string"]},"reason":{"type":["null","string"]},"performedById":{"type":"string"},"performedAt":{"type":"string"}}}}}}}}}}}}}},"/api/v1/inventory/adjust":{"post":{"summary":"Manual stock adjustment","tags":["Inventory"],"description":"Apply a manual stock adjustment with a reason. Positive quantity increases on-hand, negative decreases it. Creates an ADJUSTMENT_POSITIVE or ADJUSTMENT_NEGATIVE movement record.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["skuId","locationId","quantity","reason"],"properties":{"skuId":{"type":"string"},"locationId":{"type":"string"},"quantity":{"type":"number"},"reason":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"stockLevel":{"type":"object","properties":{"id":{"type":"string"},"skuId":{"type":"string"},"locationId":{"type":"string"},"quantityOnHand":{"type":"number"},"quantityAllocated":{"type":"number"},"quantityInTransit":{"type":"number"},"quantityOnOrder":{"type":"number"},"reorderPoint":{"type":["null","number"]},"reorderQuantity":{"type":["null","number"]},"lastCountedAt":{"type":["null","string"]},"updatedAt":{"type":"string"}}},"movement":{"type":"object","properties":{"id":{"type":"string"},"skuId":{"type":"string"},"type":{"type":"string"},"quantity":{"type":"number"},"fromLocationId":{"type":["null","string"]},"toLocationId":{"type":["null","string"]},"referenceType":{"type":["null","string"]},"referenceId":{"type":["null","string"]},"reason":{"type":["null","string"]},"performedById":{"type":"string"},"performedAt":{"type":"string"}}}}}}}}}}},"/api/v1/inventory/reconcile":{"post":{"summary":"Reconcile RFID count data","tags":["Inventory"],"description":"Process RFID count data for a location. Compares provided counts against system quantities, updates stock levels, flags discrepancies, and creates RFID_RECONCILIATION movement records for differences.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["locationId","counts"],"properties":{"locationId":{"type":"string"},"counts":{"type":"array","items":{"type":"object","required":["skuId","countedQuantity"],"properties":{"skuId":{"type":"string"},"countedQuantity":{"type":"number","minimum":0}}}}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"locationId":{"type":"string"},"totalCounted":{"type":"number"},"discrepancies":{"type":"number"},"results":{"type":"array","items":{"type":"object","properties":{"skuId":{"type":"string"},"systemQuantity":{"type":"number"},"countedQuantity":{"type":"number"},"difference":{"type":"number"},"hasDiscrepancy":{"type":"boolean"},"movementId":{"type":["null","string"]}}}}}}}}}}}},"/api/v1/inventory/movements":{"get":{"summary":"List stock movements","tags":["Inventory"],"description":"Returns stock movement history sorted by most recent first. Filter by skuId, movement type, location, or reference.","parameters":[{"schema":{"type":"string"},"in":"query","name":"skuId","required":false},{"schema":{"type":"string"},"in":"query","name":"type","required":false},{"schema":{"type":"string"},"in":"query","name":"fromLocationId","required":false},{"schema":{"type":"string"},"in":"query","name":"toLocationId","required":false},{"schema":{"type":"string"},"in":"query","name":"referenceType","required":false},{"schema":{"type":"string"},"in":"query","name":"referenceId","required":false},{"schema":{"type":"number","default":1},"in":"query","name":"page","required":false},{"schema":{"type":"number","default":20},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"skuId":{"type":"string"},"type":{"type":"string"},"quantity":{"type":"number"},"fromLocationId":{"type":["null","string"]},"toLocationId":{"type":["null","string"]},"referenceType":{"type":["null","string"]},"referenceId":{"type":["null","string"]},"reason":{"type":["null","string"]},"performedById":{"type":"string"},"performedAt":{"type":"string"}}}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}}}}}}}}}}},"/api/v1/inventory/alerts":{"get":{"summary":"Low stock alerts","tags":["Inventory"],"description":"Returns stock levels where quantityOnHand is at or below the reorderPoint. Each alert includes the alertType (LOW_STOCK or OUT_OF_STOCK) and the deficit amount.","parameters":[{"schema":{"type":"string"},"in":"query","name":"locationId","required":false},{"schema":{"type":"string"},"in":"query","name":"skuId","required":false},{"schema":{"type":"number","default":1},"in":"query","name":"page","required":false},{"schema":{"type":"number","default":20},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"skuId":{"type":"string"},"locationId":{"type":"string"},"quantityOnHand":{"type":"number"},"quantityAllocated":{"type":"number"},"quantityInTransit":{"type":"number"},"quantityOnOrder":{"type":"number"},"reorderPoint":{"type":["null","number"]},"reorderQuantity":{"type":["null","number"]},"lastCountedAt":{"type":["null","string"]},"updatedAt":{"type":"string"},"alertType":{"type":"string"},"deficit":{"type":"number"}}}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}}}}}}}}}}},"/api/v1/sales-orders":{"post":{"summary":"Create sales order","tags":["Sales Orders"],"description":"Create a new sales order in DRAFT status. The SO number is generated automatically based on the channel (e.g. SO-RT-{STORE_CODE}-{SEQ} for retail).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["channel","type","currency"],"properties":{"channel":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"type":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"locationId":{"type":"string"},"customerId":{"type":"string"},"customerName":{"type":"string"},"customerEmail":{"type":"string"},"wholesaleBuyerId":{"type":"string"},"shippingAddress":{"type":"string"},"shippingCity":{"type":"string"},"shippingCountry":{"type":"string"},"requestedShipDate":{"type":"string"},"notes":{"type":"string"},"priority":{"type":"number","default":0},"storeCode":{"type":"string","description":"Store code for SO number generation (RETAIL_STORE, CLIENTELING)"},"region":{"type":"string","description":"Region code for SO number generation (ECOMMERCE)"},"buyerCode":{"type":"string","description":"Buyer code for SO number generation (WHOLESALE)"},"platform":{"type":"string","description":"Platform code for SO number generation (MARKETPLACE)"}}}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"soNumber":{"type":"string"},"channel":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"type":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"status":{"type":"string","enum":["DRAFT","CONFIRMED","ALLOCATED","PICKING","PACKED","SHIPPED","PARTIALLY_SHIPPED","DELIVERED","RETURNED","CANCELLED","ON_HOLD"]},"locationId":{"type":["null","string"]},"customerId":{"type":["null","string"]},"customerName":{"type":["null","string"]},"customerEmail":{"type":["null","string"]},"wholesaleBuyerId":{"type":["null","string"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"discountAmount":{"type":"number"},"totalAmount":{"type":"number"},"shippingAddress":{"type":["null","string"]},"shippingCity":{"type":["null","string"]},"shippingCountry":{"type":["null","string"]},"requestedShipDate":{"type":["null","string"]},"actualShipDate":{"type":["null","string"]},"deliveredAt":{"type":["null","string"]},"notes":{"type":["null","string"]},"priority":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}},"get":{"summary":"List sales orders","tags":["Sales Orders"],"description":"List all sales orders with optional filters for channel, status, type, locationId. Supports text search across SO number, customer name, and customer email.","parameters":[{"schema":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"in":"query","name":"channel","required":false},{"schema":{"type":"string","enum":["DRAFT","CONFIRMED","ALLOCATED","PICKING","PACKED","SHIPPED","PARTIALLY_SHIPPED","DELIVERED","RETURNED","CANCELLED","ON_HOLD"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"in":"query","name":"type","required":false},{"schema":{"type":"string"},"in":"query","name":"locationId","required":false},{"schema":{"type":"string"},"in":"query","name":"search","required":false},{"schema":{"type":"number","default":1},"in":"query","name":"page","required":false},{"schema":{"type":"number","default":20},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"soNumber":{"type":"string"},"channel":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"type":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"status":{"type":"string","enum":["DRAFT","CONFIRMED","ALLOCATED","PICKING","PACKED","SHIPPED","PARTIALLY_SHIPPED","DELIVERED","RETURNED","CANCELLED","ON_HOLD"]},"locationId":{"type":["null","string"]},"customerId":{"type":["null","string"]},"customerName":{"type":["null","string"]},"customerEmail":{"type":["null","string"]},"wholesaleBuyerId":{"type":["null","string"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"discountAmount":{"type":"number"},"totalAmount":{"type":"number"},"shippingAddress":{"type":["null","string"]},"shippingCity":{"type":["null","string"]},"shippingCountry":{"type":["null","string"]},"requestedShipDate":{"type":["null","string"]},"actualShipDate":{"type":["null","string"]},"deliveredAt":{"type":["null","string"]},"notes":{"type":["null","string"]},"priority":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}}}}}}}}}}},"/api/v1/sales-orders/{id}":{"get":{"summary":"Get sales order by ID","tags":["Sales Orders"],"description":"Returns full sales order details including all line items and shipments.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"soNumber":{"type":"string"},"channel":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"type":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"status":{"type":"string","enum":["DRAFT","CONFIRMED","ALLOCATED","PICKING","PACKED","SHIPPED","PARTIALLY_SHIPPED","DELIVERED","RETURNED","CANCELLED","ON_HOLD"]},"locationId":{"type":["null","string"]},"customerId":{"type":["null","string"]},"customerName":{"type":["null","string"]},"customerEmail":{"type":["null","string"]},"wholesaleBuyerId":{"type":["null","string"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"discountAmount":{"type":"number"},"totalAmount":{"type":"number"},"shippingAddress":{"type":["null","string"]},"shippingCity":{"type":["null","string"]},"shippingCountry":{"type":["null","string"]},"requestedShipDate":{"type":["null","string"]},"actualShipDate":{"type":["null","string"]},"deliveredAt":{"type":["null","string"]},"notes":{"type":["null","string"]},"priority":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"salesOrderId":{"type":"string"},"skuId":{"type":"string"},"quantityOrdered":{"type":"number"},"quantityAllocated":{"type":"number"},"quantityShipped":{"type":"number"},"quantityReturned":{"type":"number"},"unitPrice":{"type":"number"},"discountPercent":{"type":"number"},"lineTotal":{"type":"number"},"notes":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}},"shipments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"salesOrderId":{"type":"string"},"trackingNumber":{"type":["null","string"]},"carrier":{"type":["null","string"]},"shippedAt":{"type":["null","string"]},"deliveredAt":{"type":["null","string"]},"createdAt":{"type":"string"}}}}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}},"patch":{"summary":"Update sales order","tags":["Sales Orders"],"description":"Update editable fields on a sales order. Only allowed when the order is in DRAFT or CONFIRMED status.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerName":{"type":"string"},"customerEmail":{"type":"string"},"shippingAddress":{"type":"string"},"shippingCity":{"type":"string"},"shippingCountry":{"type":"string"},"requestedShipDate":{"type":"string"},"notes":{"type":"string"},"priority":{"type":"number"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"soNumber":{"type":"string"},"channel":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"type":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"status":{"type":"string","enum":["DRAFT","CONFIRMED","ALLOCATED","PICKING","PACKED","SHIPPED","PARTIALLY_SHIPPED","DELIVERED","RETURNED","CANCELLED","ON_HOLD"]},"locationId":{"type":["null","string"]},"customerId":{"type":["null","string"]},"customerName":{"type":["null","string"]},"customerEmail":{"type":["null","string"]},"wholesaleBuyerId":{"type":["null","string"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"discountAmount":{"type":"number"},"totalAmount":{"type":"number"},"shippingAddress":{"type":["null","string"]},"shippingCity":{"type":["null","string"]},"shippingCountry":{"type":["null","string"]},"requestedShipDate":{"type":["null","string"]},"actualShipDate":{"type":["null","string"]},"deliveredAt":{"type":["null","string"]},"notes":{"type":["null","string"]},"priority":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/v1/sales-orders/{id}/lines":{"post":{"summary":"Add line items","tags":["Sales Orders"],"description":"Add one or more line items to a sales order. Automatically recalculates subtotal, tax (25% VAT), and total. Only allowed when the order is in DRAFT or CONFIRMED status.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["lines"],"properties":{"lines":{"type":"array","minItems":1,"items":{"type":"object","required":["skuId","quantityOrdered","unitPrice"],"properties":{"skuId":{"type":"string"},"quantityOrdered":{"type":"number","minimum":1},"unitPrice":{"type":"number","minimum":0},"discountPercent":{"type":"number","minimum":0,"maximum":100,"default":0},"notes":{"type":"string"}}}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"soNumber":{"type":"string"},"channel":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"type":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"status":{"type":"string","enum":["DRAFT","CONFIRMED","ALLOCATED","PICKING","PACKED","SHIPPED","PARTIALLY_SHIPPED","DELIVERED","RETURNED","CANCELLED","ON_HOLD"]},"locationId":{"type":["null","string"]},"customerId":{"type":["null","string"]},"customerName":{"type":["null","string"]},"customerEmail":{"type":["null","string"]},"wholesaleBuyerId":{"type":["null","string"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"discountAmount":{"type":"number"},"totalAmount":{"type":"number"},"shippingAddress":{"type":["null","string"]},"shippingCity":{"type":["null","string"]},"shippingCountry":{"type":["null","string"]},"requestedShipDate":{"type":["null","string"]},"actualShipDate":{"type":["null","string"]},"deliveredAt":{"type":["null","string"]},"notes":{"type":["null","string"]},"priority":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"salesOrderId":{"type":"string"},"skuId":{"type":"string"},"quantityOrdered":{"type":"number"},"quantityAllocated":{"type":"number"},"quantityShipped":{"type":"number"},"quantityReturned":{"type":"number"},"unitPrice":{"type":"number"},"discountPercent":{"type":"number"},"lineTotal":{"type":"number"},"notes":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/v1/sales-orders/{id}/confirm":{"post":{"summary":"Confirm sales order","tags":["Sales Orders"],"description":"Transition the order from DRAFT to CONFIRMED. Records a status history entry.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"soNumber":{"type":"string"},"channel":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"type":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"status":{"type":"string","enum":["DRAFT","CONFIRMED","ALLOCATED","PICKING","PACKED","SHIPPED","PARTIALLY_SHIPPED","DELIVERED","RETURNED","CANCELLED","ON_HOLD"]},"locationId":{"type":["null","string"]},"customerId":{"type":["null","string"]},"customerName":{"type":["null","string"]},"customerEmail":{"type":["null","string"]},"wholesaleBuyerId":{"type":["null","string"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"discountAmount":{"type":"number"},"totalAmount":{"type":"number"},"shippingAddress":{"type":["null","string"]},"shippingCity":{"type":["null","string"]},"shippingCountry":{"type":["null","string"]},"requestedShipDate":{"type":["null","string"]},"actualShipDate":{"type":["null","string"]},"deliveredAt":{"type":["null","string"]},"notes":{"type":["null","string"]},"priority":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/v1/sales-orders/{id}/allocate":{"post":{"summary":"Allocate stock for sales order","tags":["Sales Orders"],"description":"Transition the order from CONFIRMED to ALLOCATED. Sets quantityAllocated on all line items to match quantityOrdered.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"soNumber":{"type":"string"},"channel":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"type":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"status":{"type":"string","enum":["DRAFT","CONFIRMED","ALLOCATED","PICKING","PACKED","SHIPPED","PARTIALLY_SHIPPED","DELIVERED","RETURNED","CANCELLED","ON_HOLD"]},"locationId":{"type":["null","string"]},"customerId":{"type":["null","string"]},"customerName":{"type":["null","string"]},"customerEmail":{"type":["null","string"]},"wholesaleBuyerId":{"type":["null","string"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"discountAmount":{"type":"number"},"totalAmount":{"type":"number"},"shippingAddress":{"type":["null","string"]},"shippingCity":{"type":["null","string"]},"shippingCountry":{"type":["null","string"]},"requestedShipDate":{"type":["null","string"]},"actualShipDate":{"type":["null","string"]},"deliveredAt":{"type":["null","string"]},"notes":{"type":["null","string"]},"priority":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/v1/sales-orders/{id}/pick":{"post":{"summary":"Start picking for sales order","tags":["Sales Orders"],"description":"Transition the order from ALLOCATED to PICKING. Indicates warehouse has begun the pick process.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"soNumber":{"type":"string"},"channel":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"type":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"status":{"type":"string","enum":["DRAFT","CONFIRMED","ALLOCATED","PICKING","PACKED","SHIPPED","PARTIALLY_SHIPPED","DELIVERED","RETURNED","CANCELLED","ON_HOLD"]},"locationId":{"type":["null","string"]},"customerId":{"type":["null","string"]},"customerName":{"type":["null","string"]},"customerEmail":{"type":["null","string"]},"wholesaleBuyerId":{"type":["null","string"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"discountAmount":{"type":"number"},"totalAmount":{"type":"number"},"shippingAddress":{"type":["null","string"]},"shippingCity":{"type":["null","string"]},"shippingCountry":{"type":["null","string"]},"requestedShipDate":{"type":["null","string"]},"actualShipDate":{"type":["null","string"]},"deliveredAt":{"type":["null","string"]},"notes":{"type":["null","string"]},"priority":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/v1/sales-orders/{id}/pack":{"post":{"summary":"Mark sales order as packed","tags":["Sales Orders"],"description":"Transition the order from PICKING to PACKED. Indicates all items have been picked and packed, ready for shipment.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"soNumber":{"type":"string"},"channel":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"type":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"status":{"type":"string","enum":["DRAFT","CONFIRMED","ALLOCATED","PICKING","PACKED","SHIPPED","PARTIALLY_SHIPPED","DELIVERED","RETURNED","CANCELLED","ON_HOLD"]},"locationId":{"type":["null","string"]},"customerId":{"type":["null","string"]},"customerName":{"type":["null","string"]},"customerEmail":{"type":["null","string"]},"wholesaleBuyerId":{"type":["null","string"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"discountAmount":{"type":"number"},"totalAmount":{"type":"number"},"shippingAddress":{"type":["null","string"]},"shippingCity":{"type":["null","string"]},"shippingCountry":{"type":["null","string"]},"requestedShipDate":{"type":["null","string"]},"actualShipDate":{"type":["null","string"]},"deliveredAt":{"type":["null","string"]},"notes":{"type":["null","string"]},"priority":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/v1/sales-orders/{id}/ship":{"post":{"summary":"Record shipment for sales order","tags":["Sales Orders"],"description":"Transition the order from PACKED to SHIPPED. Creates a Shipment record with optional tracking number and carrier. Updates actualShipDate and marks all line items as shipped.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"},"trackingNumber":{"type":"string"},"carrier":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"soNumber":{"type":"string"},"channel":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"type":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"status":{"type":"string","enum":["DRAFT","CONFIRMED","ALLOCATED","PICKING","PACKED","SHIPPED","PARTIALLY_SHIPPED","DELIVERED","RETURNED","CANCELLED","ON_HOLD"]},"locationId":{"type":["null","string"]},"customerId":{"type":["null","string"]},"customerName":{"type":["null","string"]},"customerEmail":{"type":["null","string"]},"wholesaleBuyerId":{"type":["null","string"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"discountAmount":{"type":"number"},"totalAmount":{"type":"number"},"shippingAddress":{"type":["null","string"]},"shippingCity":{"type":["null","string"]},"shippingCountry":{"type":["null","string"]},"requestedShipDate":{"type":["null","string"]},"actualShipDate":{"type":["null","string"]},"deliveredAt":{"type":["null","string"]},"notes":{"type":["null","string"]},"priority":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/v1/sales-orders/{id}/deliver":{"post":{"summary":"Mark sales order as delivered","tags":["Sales Orders"],"description":"Transition the order from SHIPPED to DELIVERED. Sets deliveredAt on the order and associated shipments.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"soNumber":{"type":"string"},"channel":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"type":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"status":{"type":"string","enum":["DRAFT","CONFIRMED","ALLOCATED","PICKING","PACKED","SHIPPED","PARTIALLY_SHIPPED","DELIVERED","RETURNED","CANCELLED","ON_HOLD"]},"locationId":{"type":["null","string"]},"customerId":{"type":["null","string"]},"customerName":{"type":["null","string"]},"customerEmail":{"type":["null","string"]},"wholesaleBuyerId":{"type":["null","string"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"discountAmount":{"type":"number"},"totalAmount":{"type":"number"},"shippingAddress":{"type":["null","string"]},"shippingCity":{"type":["null","string"]},"shippingCountry":{"type":["null","string"]},"requestedShipDate":{"type":["null","string"]},"actualShipDate":{"type":["null","string"]},"deliveredAt":{"type":["null","string"]},"notes":{"type":["null","string"]},"priority":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/v1/sales-orders/{id}/return":{"post":{"summary":"Initiate return for sales order","tags":["Sales Orders"],"description":"Transition the order to RETURNED (valid from any post-SHIPPED state). Marks all shipped line items as returned.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"soNumber":{"type":"string"},"channel":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"type":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"status":{"type":"string","enum":["DRAFT","CONFIRMED","ALLOCATED","PICKING","PACKED","SHIPPED","PARTIALLY_SHIPPED","DELIVERED","RETURNED","CANCELLED","ON_HOLD"]},"locationId":{"type":["null","string"]},"customerId":{"type":["null","string"]},"customerName":{"type":["null","string"]},"customerEmail":{"type":["null","string"]},"wholesaleBuyerId":{"type":["null","string"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"discountAmount":{"type":"number"},"totalAmount":{"type":"number"},"shippingAddress":{"type":["null","string"]},"shippingCity":{"type":["null","string"]},"shippingCountry":{"type":["null","string"]},"requestedShipDate":{"type":["null","string"]},"actualShipDate":{"type":["null","string"]},"deliveredAt":{"type":["null","string"]},"notes":{"type":["null","string"]},"priority":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/v1/sales-orders/{id}/cancel":{"post":{"summary":"Cancel sales order","tags":["Sales Orders"],"description":"Transition the order to CANCELLED (valid from any pre-SHIPPED state). A reason should be provided for audit purposes.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"soNumber":{"type":"string"},"channel":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"type":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"status":{"type":"string","enum":["DRAFT","CONFIRMED","ALLOCATED","PICKING","PACKED","SHIPPED","PARTIALLY_SHIPPED","DELIVERED","RETURNED","CANCELLED","ON_HOLD"]},"locationId":{"type":["null","string"]},"customerId":{"type":["null","string"]},"customerName":{"type":["null","string"]},"customerEmail":{"type":["null","string"]},"wholesaleBuyerId":{"type":["null","string"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"discountAmount":{"type":"number"},"totalAmount":{"type":"number"},"shippingAddress":{"type":["null","string"]},"shippingCity":{"type":["null","string"]},"shippingCountry":{"type":["null","string"]},"requestedShipDate":{"type":["null","string"]},"actualShipDate":{"type":["null","string"]},"deliveredAt":{"type":["null","string"]},"notes":{"type":["null","string"]},"priority":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/v1/sales-orders/{id}/hold":{"post":{"summary":"Put sales order on hold","tags":["Sales Orders"],"description":"Transition the order to ON_HOLD from any state. The previous status is remembered so the order can be released back to it.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"soNumber":{"type":"string"},"channel":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"type":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"status":{"type":"string","enum":["DRAFT","CONFIRMED","ALLOCATED","PICKING","PACKED","SHIPPED","PARTIALLY_SHIPPED","DELIVERED","RETURNED","CANCELLED","ON_HOLD"]},"locationId":{"type":["null","string"]},"customerId":{"type":["null","string"]},"customerName":{"type":["null","string"]},"customerEmail":{"type":["null","string"]},"wholesaleBuyerId":{"type":["null","string"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"discountAmount":{"type":"number"},"totalAmount":{"type":"number"},"shippingAddress":{"type":["null","string"]},"shippingCity":{"type":["null","string"]},"shippingCountry":{"type":["null","string"]},"requestedShipDate":{"type":["null","string"]},"actualShipDate":{"type":["null","string"]},"deliveredAt":{"type":["null","string"]},"notes":{"type":["null","string"]},"priority":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/v1/sales-orders/{id}/release":{"post":{"summary":"Release sales order from hold","tags":["Sales Orders"],"description":"Release the order from ON_HOLD, restoring it to the status it had before being put on hold.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"soNumber":{"type":"string"},"channel":{"type":"string","enum":["RETAIL_STORE","ECOMMERCE","WHOLESALE","MARKETPLACE","CLIENTELING"]},"type":{"type":"string","enum":["STANDARD","PRE_ORDER","BACK_ORDER","TRANSFER","REPLENISHMENT","RETURN","EXCHANGE"]},"status":{"type":"string","enum":["DRAFT","CONFIRMED","ALLOCATED","PICKING","PACKED","SHIPPED","PARTIALLY_SHIPPED","DELIVERED","RETURNED","CANCELLED","ON_HOLD"]},"locationId":{"type":["null","string"]},"customerId":{"type":["null","string"]},"customerName":{"type":["null","string"]},"customerEmail":{"type":["null","string"]},"wholesaleBuyerId":{"type":["null","string"]},"currency":{"type":"string","enum":["SEK","EUR","USD","GBP","JPY","CNY","KRW","AUD","CAD","SGD","HKD"]},"subtotal":{"type":"number"},"taxAmount":{"type":"number"},"discountAmount":{"type":"number"},"totalAmount":{"type":"number"},"shippingAddress":{"type":["null","string"]},"shippingCity":{"type":["null","string"]},"shippingCountry":{"type":["null","string"]},"requestedShipDate":{"type":["null","string"]},"actualShipDate":{"type":["null","string"]},"deliveredAt":{"type":["null","string"]},"notes":{"type":["null","string"]},"priority":{"type":"number"},"createdById":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/v1/sales-orders/{id}/history":{"get":{"summary":"Get status history","tags":["Sales Orders"],"description":"Returns the complete status transition history for a sales order, ordered chronologically.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"salesOrderId":{"type":"string"},"fromStatus":{"type":["null","string"]},"toStatus":{"type":"string"},"changedById":{"type":"string"},"reason":{"type":["null","string"]},"changedAt":{"type":"string"}}}}}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/v1/stakeholders/roles":{"get":{"summary":"List all available roles","tags":["Stakeholders"],"description":"Returns every UserRole enum value together with a human-readable description of the team or function it represents.","responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"description":{"type":"string"}}}}}}}}}}}},"/api/v1/stakeholders/locations":{"get":{"summary":"List all locations","tags":["Stakeholders"],"description":"Returns all warehouses, retail stores, and office locations available in the system.","responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"address":{"type":"string"},"city":{"type":"string"},"country":{"type":"string"},"countryCode":{"type":"string"},"region":{"type":"string"},"timezone":{"type":"string"},"isActive":{"type":"boolean"},"createdAt":{"type":"string"}}}}}}}}}}}},"/api/v1/stakeholders/suppliers":{"get":{"summary":"List all suppliers","tags":["Stakeholders"],"description":"Returns all registered suppliers / manufacturers including contact details and lead times.","responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"type":"string"},"contactName":{"type":["null","string"]},"contactEmail":{"type":["null","string"]},"country":{"type":"string"},"leadTimeDays":{"type":"number"},"paymentTerms":{"type":["null","string"]},"currency":{"type":"string"},"isActive":{"type":"boolean"},"fairWearScore":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}}}}}},"/api/v1/stakeholders":{"get":{"summary":"List all stakeholders","tags":["Stakeholders"],"description":"List all users with optional filters for role, locationId, supplierId, and active status. Supports free-text search across name and email.","parameters":[{"schema":{"type":"string","enum":["BUYER","WHOLESALE","STORE_MGR","STORE_ASSOC","ECOM","WAREHOUSE","SUPPLIER","FINANCE","PLANNER","EXEC","CS_AGENT","QA","ADMIN"]},"in":"query","name":"role","required":false},{"schema":{"type":"string"},"in":"query","name":"locationId","required":false},{"schema":{"type":"string"},"in":"query","name":"supplierId","required":false},{"schema":{"type":"boolean"},"in":"query","name":"isActive","required":false},{"schema":{"type":"string"},"in":"query","name":"search","required":false},{"schema":{"type":"number","default":1},"in":"query","name":"page","required":false},{"schema":{"type":"number","default":20},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"role":{"type":"string","enum":["BUYER","WHOLESALE","STORE_MGR","STORE_ASSOC","ECOM","WAREHOUSE","SUPPLIER","FINANCE","PLANNER","EXEC","CS_AGENT","QA","ADMIN"]},"isActive":{"type":"boolean"},"locationId":{"type":["null","string"]},"supplierId":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}}}}}}}}}},"post":{"summary":"Create a new stakeholder","tags":["Stakeholders"],"description":"Create a new user with the specified role and optional location/supplier assignment. Defaults password to \"hackathon2026\" if not provided.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","firstName","lastName","role"],"properties":{"email":{"type":"string","format":"email"},"firstName":{"type":"string","minLength":1},"lastName":{"type":"string","minLength":1},"role":{"type":"string","enum":["BUYER","WHOLESALE","STORE_MGR","STORE_ASSOC","ECOM","WAREHOUSE","SUPPLIER","FINANCE","PLANNER","EXEC","CS_AGENT","QA","ADMIN"]},"locationId":{"type":"string"},"supplierId":{"type":"string"},"password":{"type":"string","minLength":1}}}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"role":{"type":"string","enum":["BUYER","WHOLESALE","STORE_MGR","STORE_ASSOC","ECOM","WAREHOUSE","SUPPLIER","FINANCE","PLANNER","EXEC","CS_AGENT","QA","ADMIN"]},"isActive":{"type":"boolean"},"locationId":{"type":["null","string"]},"supplierId":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}}},"/api/v1/stakeholders/{id}":{"get":{"summary":"Get stakeholder by ID","tags":["Stakeholders"],"description":"Returns full user details for a single stakeholder (password hash excluded).","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"role":{"type":"string","enum":["BUYER","WHOLESALE","STORE_MGR","STORE_ASSOC","ECOM","WAREHOUSE","SUPPLIER","FINANCE","PLANNER","EXEC","CS_AGENT","QA","ADMIN"]},"isActive":{"type":"boolean"},"locationId":{"type":["null","string"]},"supplierId":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}},"patch":{"summary":"Update a stakeholder","tags":["Stakeholders"],"description":"Partially update a stakeholder's profile. Any fields omitted from the body are left unchanged.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"firstName":{"type":"string","minLength":1},"lastName":{"type":"string","minLength":1},"role":{"type":"string","enum":["BUYER","WHOLESALE","STORE_MGR","STORE_ASSOC","ECOM","WAREHOUSE","SUPPLIER","FINANCE","PLANNER","EXEC","CS_AGENT","QA","ADMIN"]},"locationId":{"type":["string","null"]},"supplierId":{"type":["string","null"]},"isActive":{"type":"boolean"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"role":{"type":"string","enum":["BUYER","WHOLESALE","STORE_MGR","STORE_ASSOC","ECOM","WAREHOUSE","SUPPLIER","FINANCE","PLANNER","EXEC","CS_AGENT","QA","ADMIN"]},"isActive":{"type":"boolean"},"locationId":{"type":["null","string"]},"supplierId":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}},"delete":{"summary":"Deactivate a stakeholder","tags":["Stakeholders"],"description":"Soft-deletes a stakeholder by setting isActive to false. The user record is retained for audit purposes.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/v1/stakeholders/customers":{"get":{"summary":"List customers","tags":["Stakeholders"],"description":"Returns paginated list of persistent customers with behavior profiles (VIC, REGULAR, RETURNING, BARGAIN_HUNTER, TOURIST). Customers accumulate purchase history as the simulation runs.","parameters":[{"schema":{"type":"number","default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"number","default":0},"in":"query","name":"offset","required":false},{"schema":{"type":"string","enum":["VIC","REGULAR","RETURNING","BARGAIN_HUNTER","TOURIST"]},"in":"query","name":"profile","required":false},{"schema":{"type":"string"},"in":"query","name":"country","required":false},{"schema":{"type":"string","enum":["BRONZE","SILVER","GOLD","PLATINUM"]},"in":"query","name":"tier","required":false},{"schema":{"type":"number"},"in":"query","name":"minOrders","required":false},{"schema":{"type":"string","enum":["totalSpent","totalOrders","lastOrderAt","firstOrderAt"]},"in":"query","name":"sort","required":false},{"schema":{"type":"string","enum":["asc","desc"],"default":"desc"},"in":"query","name":"order","required":false}],"responses":{"200":{"description":"Default Response"}}}},"/api/v1/stakeholders/customers/{id}":{"get":{"summary":"Get customer by ID","tags":["Stakeholders"],"description":"Returns a single customer including order history derived from sales orders.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/api/v1/stakeholders/customers/stats":{"get":{"summary":"Customer segmentation stats","tags":["Stakeholders"],"description":"Returns aggregate stats per customer profile.","responses":{"200":{"description":"Default Response"}}}},"/api/v1/webhooks/salesforce":{"post":{"summary":"Salesforce Commerce Cloud webhook","tags":["Webhooks"],"description":"Inbound webhook endpoint for SFCC e-commerce order events. Accepts any JSON body, stores it in the in-memory webhook log, and returns a success acknowledgement.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"},"webhookId":{"type":"string"},"receivedAt":{"type":"string"}}}}}}}}},"/api/v1/webhooks/nuorder":{"post":{"summary":"NuORDER webhook","tags":["Webhooks"],"description":"Inbound webhook endpoint for NuORDER wholesale order events. Accepts any JSON body, stores it in the in-memory webhook log, and returns a success acknowledgement.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"},"webhookId":{"type":"string"},"receivedAt":{"type":"string"}}}}}}}}},"/api/v1/webhooks/nedap":{"post":{"summary":"Nedap RFID webhook","tags":["Webhooks"],"description":"Inbound webhook endpoint for Nedap iD Cloud RFID stock count events. Accepts any JSON body, stores it in the in-memory webhook log, and returns a success acknowledgement.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"},"webhookId":{"type":"string"},"receivedAt":{"type":"string"}}}}}}}}},"/api/v1/webhooks/carrier":{"post":{"summary":"Carrier tracking webhook","tags":["Webhooks"],"description":"Inbound webhook endpoint for carrier delivery tracking events. Accepts any JSON body, stores it in the in-memory webhook log, and returns a success acknowledgement.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"},"webhookId":{"type":"string"},"receivedAt":{"type":"string"}}}}}}}}},"/api/v1/webhooks/log":{"get":{"summary":"View webhook history","tags":["Webhooks"],"description":"Returns the in-memory log of all received webhooks, most recent first. Optionally filter by source (salesforce, nuorder, nedap, carrier) and limit results.","parameters":[{"schema":{"type":"string","enum":["salesforce","nuorder","nedap","carrier"]},"in":"query","name":"source","required":false},{"schema":{"type":"number","default":50},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"source":{"type":"string"},"receivedAt":{"type":"string"},"headers":{"type":"object","additionalProperties":true},"body":{"type":"object","additionalProperties":true}}}},"total":{"type":"number"}}}}}}}}},"/api/v1/matching/run":{"post":{"summary":"Trigger a matching run","tags":["Matching"],"description":"Run the SO↔PO matching engine. Optionally filter by season, seasonYear, or skuId. Creates SOPOMatch proposals (score >= 0.50) and auto-confirms matches scoring >= 0.85. Returns the MatchingRun summary and all newly created match records.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"season":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"seasonYear":{"type":"number"},"skuId":{"type":"string"},"triggeredBy":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"run":{"type":"object","properties":{"id":{"type":"string"},"triggeredBy":{"type":"string"},"matchesProposed":{"type":"number"},"matchesAutoConfirmed":{"type":"number"},"matchesRequiringReview":{"type":"number"},"unmatched":{"type":"number"},"avgMatchScore":{"type":["null","number"]},"executionTimeMs":{"type":["null","number"]},"modelVersion":{"type":["null","string"]},"startedAt":{"type":"string"},"completedAt":{"type":["null","string"]}}},"matches":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"salesOrderId":{"type":"string"},"salesOrderLineId":{"type":["null","string"]},"purchaseOrderId":{"type":"string"},"purchaseOrderLineId":{"type":["null","string"]},"skuId":{"type":"string"},"quantityMatched":{"type":"number"},"matchScore":{"type":"number"},"matchFactors":{"type":"object","properties":{"skuExactMatch":{"type":"number"},"timingAlignment":{"type":"number"},"locationProximity":{"type":"number"},"quantityFit":{"type":"number"},"channelPriority":{"type":"number"},"seasonAlignment":{"type":"number"},"supplierReliability":{"type":"number"},"marginContribution":{"type":"number"}}},"status":{"type":"string","enum":["PROPOSED","CONFIRMED","AUTO_CONFIRMED","REJECTED","SUPERSEDED","FULFILLED","EXPIRED"]},"proposedBy":{"type":"string"},"confirmedById":{"type":["null","string"]},"confirmedAt":{"type":["null","string"]},"rejectedReason":{"type":["null","string"]},"expectedFulfillDate":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}}}}}},"/api/v1/matching/proposals":{"get":{"summary":"List match proposals","tags":["Matching"],"description":"List all SO↔PO match proposals with optional filters for status, skuId, salesOrderId, purchaseOrderId, and score range. Results are sorted by match score descending.","parameters":[{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string"},"in":"query","name":"skuId","required":false},{"schema":{"type":"string"},"in":"query","name":"salesOrderId","required":false},{"schema":{"type":"string"},"in":"query","name":"purchaseOrderId","required":false},{"schema":{"type":"number"},"in":"query","name":"minScore","required":false},{"schema":{"type":"number"},"in":"query","name":"maxScore","required":false},{"schema":{"type":"number","default":1},"in":"query","name":"page","required":false},{"schema":{"type":"number","default":20},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"salesOrderId":{"type":"string"},"salesOrderLineId":{"type":["null","string"]},"purchaseOrderId":{"type":"string"},"purchaseOrderLineId":{"type":["null","string"]},"skuId":{"type":"string"},"quantityMatched":{"type":"number"},"matchScore":{"type":"number"},"matchFactors":{"type":"object","properties":{"skuExactMatch":{"type":"number"},"timingAlignment":{"type":"number"},"locationProximity":{"type":"number"},"quantityFit":{"type":"number"},"channelPriority":{"type":"number"},"seasonAlignment":{"type":"number"},"supplierReliability":{"type":"number"},"marginContribution":{"type":"number"}}},"status":{"type":"string","enum":["PROPOSED","CONFIRMED","AUTO_CONFIRMED","REJECTED","SUPERSEDED","FULFILLED","EXPIRED"]},"proposedBy":{"type":"string"},"confirmedById":{"type":["null","string"]},"confirmedAt":{"type":["null","string"]},"rejectedReason":{"type":["null","string"]},"expectedFulfillDate":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}}}}}}}}}}},"/api/v1/matching/proposals/{id}":{"get":{"summary":"Get match proposal details","tags":["Matching"],"description":"Returns full match details including scoring factor breakdown, linked SO/PO/SKU entities, and line-level information.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"salesOrderId":{"type":"string"},"salesOrderLineId":{"type":["null","string"]},"purchaseOrderId":{"type":"string"},"purchaseOrderLineId":{"type":["null","string"]},"skuId":{"type":"string"},"quantityMatched":{"type":"number"},"matchScore":{"type":"number"},"matchFactors":{"type":"object","properties":{"skuExactMatch":{"type":"number"},"timingAlignment":{"type":"number"},"locationProximity":{"type":"number"},"quantityFit":{"type":"number"},"channelPriority":{"type":"number"},"seasonAlignment":{"type":"number"},"supplierReliability":{"type":"number"},"marginContribution":{"type":"number"}}},"status":{"type":"string","enum":["PROPOSED","CONFIRMED","AUTO_CONFIRMED","REJECTED","SUPERSEDED","FULFILLED","EXPIRED"]},"proposedBy":{"type":"string"},"confirmedById":{"type":["null","string"]},"confirmedAt":{"type":["null","string"]},"rejectedReason":{"type":["null","string"]},"expectedFulfillDate":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"salesOrder":{"type":"object","additionalProperties":true},"purchaseOrder":{"type":"object","additionalProperties":true},"soLine":{"type":["null","object"],"additionalProperties":true},"poLine":{"type":["null","object"],"additionalProperties":true},"sku":{"type":["null","object"],"additionalProperties":true}}}}}}}}},"/api/v1/matching/proposals/{id}/confirm":{"post":{"summary":"Confirm a match proposal","tags":["Matching"],"description":"Confirm a PROPOSED match. Only matches in PROPOSED status can be confirmed. Updates status to CONFIRMED with confirmer and timestamp.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"confirmedById":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"salesOrderId":{"type":"string"},"salesOrderLineId":{"type":["null","string"]},"purchaseOrderId":{"type":"string"},"purchaseOrderLineId":{"type":["null","string"]},"skuId":{"type":"string"},"quantityMatched":{"type":"number"},"matchScore":{"type":"number"},"matchFactors":{"type":"object","properties":{"skuExactMatch":{"type":"number"},"timingAlignment":{"type":"number"},"locationProximity":{"type":"number"},"quantityFit":{"type":"number"},"channelPriority":{"type":"number"},"seasonAlignment":{"type":"number"},"supplierReliability":{"type":"number"},"marginContribution":{"type":"number"}}},"status":{"type":"string","enum":["PROPOSED","CONFIRMED","AUTO_CONFIRMED","REJECTED","SUPERSEDED","FULFILLED","EXPIRED"]},"proposedBy":{"type":"string"},"confirmedById":{"type":["null","string"]},"confirmedAt":{"type":["null","string"]},"rejectedReason":{"type":["null","string"]},"expectedFulfillDate":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}}},"/api/v1/matching/proposals/{id}/reject":{"post":{"summary":"Reject a match proposal","tags":["Matching"],"description":"Reject a PROPOSED match with a reason. Only matches in PROPOSED status can be rejected. The rejection reason is stored for analytics and model improvement.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["reason"],"properties":{"reason":{"type":"string"},"rejectedBy":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"salesOrderId":{"type":"string"},"salesOrderLineId":{"type":["null","string"]},"purchaseOrderId":{"type":"string"},"purchaseOrderLineId":{"type":["null","string"]},"skuId":{"type":"string"},"quantityMatched":{"type":"number"},"matchScore":{"type":"number"},"matchFactors":{"type":"object","properties":{"skuExactMatch":{"type":"number"},"timingAlignment":{"type":"number"},"locationProximity":{"type":"number"},"quantityFit":{"type":"number"},"channelPriority":{"type":"number"},"seasonAlignment":{"type":"number"},"supplierReliability":{"type":"number"},"marginContribution":{"type":"number"}}},"status":{"type":"string","enum":["PROPOSED","CONFIRMED","AUTO_CONFIRMED","REJECTED","SUPERSEDED","FULFILLED","EXPIRED"]},"proposedBy":{"type":"string"},"confirmedById":{"type":["null","string"]},"confirmedAt":{"type":["null","string"]},"rejectedReason":{"type":["null","string"]},"expectedFulfillDate":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}}},"/api/v1/matching/bulk-confirm":{"post":{"summary":"Bulk confirm matches above threshold","tags":["Matching"],"description":"Confirm all PROPOSED matches with a score at or above the given threshold (default: 0.85). Returns the count and list of confirmed matches.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"minScore":{"type":"number","default":0.85},"confirmedById":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"confirmed":{"type":"number"},"matches":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"salesOrderId":{"type":"string"},"salesOrderLineId":{"type":["null","string"]},"purchaseOrderId":{"type":"string"},"purchaseOrderLineId":{"type":["null","string"]},"skuId":{"type":"string"},"quantityMatched":{"type":"number"},"matchScore":{"type":"number"},"matchFactors":{"type":"object","properties":{"skuExactMatch":{"type":"number"},"timingAlignment":{"type":"number"},"locationProximity":{"type":"number"},"quantityFit":{"type":"number"},"channelPriority":{"type":"number"},"seasonAlignment":{"type":"number"},"supplierReliability":{"type":"number"},"marginContribution":{"type":"number"}}},"status":{"type":"string","enum":["PROPOSED","CONFIRMED","AUTO_CONFIRMED","REJECTED","SUPERSEDED","FULFILLED","EXPIRED"]},"proposedBy":{"type":"string"},"confirmedById":{"type":["null","string"]},"confirmedAt":{"type":["null","string"]},"rejectedReason":{"type":["null","string"]},"expectedFulfillDate":{"type":["null","string"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}}}}}}}}}}}},"/api/v1/matching/unmatched-sos":{"get":{"summary":"List unmatched SO lines","tags":["Matching"],"description":"Returns SO lines that have unallocated quantity and no active match proposal. Useful for identifying demand that needs sourcing attention. Filterable by season, seasonYear, and channel.","parameters":[{"schema":{"type":"string"},"in":"query","name":"season","required":false},{"schema":{"type":"number"},"in":"query","name":"seasonYear","required":false},{"schema":{"type":"string"},"in":"query","name":"channel","required":false},{"schema":{"type":"number","default":1},"in":"query","name":"page","required":false},{"schema":{"type":"number","default":20},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"soLine":{"type":"object","additionalProperties":true},"salesOrder":{"type":"object","additionalProperties":true},"sku":{"type":["null","object"],"additionalProperties":true},"unmatched":{"type":"number"}}}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}}}}}}}}}}},"/api/v1/matching/unmatched-po-capacity":{"get":{"summary":"List unmatched PO capacity","tags":["Matching"],"description":"Returns PO lines with available (unmatched) quantity. Shows supply that has not yet been allocated to any SO. Filterable by season, seasonYear, and supplierId.","parameters":[{"schema":{"type":"string"},"in":"query","name":"season","required":false},{"schema":{"type":"number"},"in":"query","name":"seasonYear","required":false},{"schema":{"type":"string"},"in":"query","name":"supplierId","required":false},{"schema":{"type":"number","default":1},"in":"query","name":"page","required":false},{"schema":{"type":"number","default":20},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"poLine":{"type":"object","additionalProperties":true},"purchaseOrder":{"type":"object","additionalProperties":true},"sku":{"type":["null","object"],"additionalProperties":true},"available":{"type":"number"}}}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}}}}}}}}}}},"/api/v1/matching/health":{"get":{"summary":"Matching health scorecard","tags":["Matching"],"description":"Seasonal matching health overview: match rate, average score, status breakdown, and per-channel statistics. Filterable by season and seasonYear.","parameters":[{"schema":{"type":"string"},"in":"query","name":"season","required":false},{"schema":{"type":"number"},"in":"query","name":"seasonYear","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"totalSOLines":{"type":"number"},"matchedSOLines":{"type":"number"},"unmatchedSOLines":{"type":"number"},"matchRate":{"type":"number"},"avgMatchScore":{"type":["null","number"]},"autoConfirmedCount":{"type":"number"},"proposedCount":{"type":"number"},"confirmedCount":{"type":"number"},"rejectedCount":{"type":"number"},"byChannel":{"type":"object","additionalProperties":true}}}}}}}}},"/api/v1/matching/timeline":{"get":{"summary":"PO arrival vs SO deadline timeline","tags":["Matching"],"description":"Day-by-day timeline showing PO arrival quantities vs SO deadline quantities for the next N days (default: 60). The gapUnits field shows demand minus supply for each day. Filterable by season and seasonYear.","parameters":[{"schema":{"type":"string"},"in":"query","name":"season","required":false},{"schema":{"type":"number"},"in":"query","name":"seasonYear","required":false},{"schema":{"type":"number","default":60},"in":"query","name":"days","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"timeline":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"poArrivals":{"type":"number"},"soDeadlines":{"type":"number"},"gapUnits":{"type":"number"}}}}}}}}}}}},"/api/v1/matching/runs":{"get":{"summary":"List matching run history","tags":["Matching"],"description":"Returns the history of matching engine runs, sorted by most recent first. Each run includes statistics on matches proposed, auto-confirmed, and unmatched.","parameters":[{"schema":{"type":"number","default":1},"in":"query","name":"page","required":false},{"schema":{"type":"number","default":20},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"triggeredBy":{"type":"string"},"matchesProposed":{"type":"number"},"matchesAutoConfirmed":{"type":"number"},"matchesRequiringReview":{"type":"number"},"unmatched":{"type":"number"},"avgMatchScore":{"type":["null","number"]},"executionTimeMs":{"type":["null","number"]},"modelVersion":{"type":["null","string"]},"startedAt":{"type":"string"},"completedAt":{"type":["null","string"]}}}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}}}}}}}}}}},"/api/v1/ai/forecasts":{"get":{"summary":"List demand forecasts","tags":["AI Intelligence"],"description":"Returns demand forecasts with optional filters for skuId, locationId, and season. Forecasts are generated by the demand_forecast ML model and cover 12-week windows.","parameters":[{"schema":{"type":"string"},"in":"query","name":"skuId","required":false},{"schema":{"type":"string"},"in":"query","name":"locationId","required":false},{"schema":{"type":"string"},"in":"query","name":"season","required":false},{"schema":{"type":"number","default":1},"in":"query","name":"page","required":false},{"schema":{"type":"number","default":20},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"skuId":{"type":"string"},"locationId":{"type":["null","string"]},"season":{"type":"string"},"seasonYear":{"type":"number"},"forecastDate":{"type":"string"},"predictedDemand":{"type":"number"},"confidenceLow":{"type":"number"},"confidenceHigh":{"type":"number"},"modelVersion":{"type":"string"},"features":{"type":["null","object"]},"createdAt":{"type":"string"}}}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}}}}}}}}}}},"/api/v1/ai/forecasts/{skuId}":{"get":{"summary":"Get detailed forecast for a SKU","tags":["AI Intelligence"],"description":"Returns all forecast data points for a specific SKU including confidence intervals, summary statistics, and model version information.","parameters":[{"schema":{"type":"string"},"in":"path","name":"skuId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"skuId":{"type":"string"},"sku":{"type":"string"},"productName":{"type":"string"},"forecasts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"skuId":{"type":"string"},"locationId":{"type":["null","string"]},"season":{"type":"string"},"seasonYear":{"type":"number"},"forecastDate":{"type":"string"},"predictedDemand":{"type":"number"},"confidenceLow":{"type":"number"},"confidenceHigh":{"type":"number"},"modelVersion":{"type":"string"},"features":{"type":["null","object"]},"createdAt":{"type":"string"}}}},"summary":{"type":"object","properties":{"totalPredictedDemand":{"type":"number"},"avgConfidenceLow":{"type":"number"},"avgConfidenceHigh":{"type":"number"},"weeksForecasted":{"type":"number"},"modelVersion":{"type":"string"}}}}}}}}}}},"/api/v1/ai/recommendations":{"get":{"summary":"List AI recommendations","tags":["AI Intelligence"],"description":"Returns active AI-generated recommendations. Filter by type (REORDER, TRANSFER, MARKDOWN, CANCEL_PO, EXPEDITE_PO) and status (PENDING, ACCEPTED, DISMISSED).","parameters":[{"schema":{"type":"string"},"in":"query","name":"type","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"number","default":1},"in":"query","name":"page","required":false},{"schema":{"type":"number","default":20},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"targetEntity":{"type":"string"},"targetId":{"type":"string"},"recommendation":{"type":"string"},"confidence":{"type":"number"},"reasoning":{"type":"object"},"impact":{"type":["null","object"]},"status":{"type":"string"},"acceptedById":{"type":["null","string"]},"acceptedAt":{"type":["null","string"]},"createdAt":{"type":"string"}}}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}}}}}}}}}}},"/api/v1/ai/recommendations/{id}/accept":{"post":{"summary":"Accept a recommendation","tags":["AI Intelligence"],"description":"Marks a PENDING recommendation as ACCEPTED. Only recommendations in PENDING status can be accepted.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"targetEntity":{"type":"string"},"targetId":{"type":"string"},"recommendation":{"type":"string"},"confidence":{"type":"number"},"reasoning":{"type":"object"},"impact":{"type":["null","object"]},"status":{"type":"string"},"acceptedById":{"type":["null","string"]},"acceptedAt":{"type":["null","string"]},"createdAt":{"type":"string"}}}}}}}}},"/api/v1/ai/recommendations/{id}/dismiss":{"post":{"summary":"Dismiss a recommendation","tags":["AI Intelligence"],"description":"Dismisses a PENDING recommendation with an optional reason. The reason is stored in the recommendation reasoning for future model improvement.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"targetEntity":{"type":"string"},"targetId":{"type":"string"},"recommendation":{"type":"string"},"confidence":{"type":"number"},"reasoning":{"type":"object"},"impact":{"type":["null","object"]},"status":{"type":"string"},"acceptedById":{"type":["null","string"]},"acceptedAt":{"type":["null","string"]},"createdAt":{"type":"string"}}}}}}}}},"/api/v1/ai/anomalies":{"get":{"summary":"List anomaly alerts","tags":["AI Intelligence"],"description":"Returns anomaly alerts detected by the anomaly_detector model. Filter by type (DEMAND_SPIKE, DEMAND_DROP, SUPPLIER_DELAY, STOCK_DISCREPANCY, MARGIN_EROSION), severity (LOW, MEDIUM, HIGH, CRITICAL), and resolution status.","parameters":[{"schema":{"type":"string"},"in":"query","name":"type","required":false},{"schema":{"type":"string"},"in":"query","name":"severity","required":false},{"schema":{"type":"boolean"},"in":"query","name":"isResolved","required":false},{"schema":{"type":"number","default":1},"in":"query","name":"page","required":false},{"schema":{"type":"number","default":20},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"severity":{"type":"string"},"entityType":{"type":"string"},"entityId":{"type":"string"},"description":{"type":"string"},"detectedValue":{"type":"number"},"expectedRange":{"type":"object","properties":{"low":{"type":"number"},"high":{"type":"number"}}},"modelVersion":{"type":"string"},"isResolved":{"type":"boolean"},"resolvedById":{"type":["null","string"]},"resolvedAt":{"type":["null","string"]},"createdAt":{"type":"string"}}}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}}}}}}}}}}},"/api/v1/ai/anomalies/{id}/resolve":{"post":{"summary":"Resolve an anomaly alert","tags":["AI Intelligence"],"description":"Marks an unresolved anomaly alert as resolved. Cannot resolve an anomaly that is already resolved.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"severity":{"type":"string"},"entityType":{"type":"string"},"entityId":{"type":"string"},"description":{"type":"string"},"detectedValue":{"type":"number"},"expectedRange":{"type":"object","properties":{"low":{"type":"number"},"high":{"type":"number"}}},"modelVersion":{"type":"string"},"isResolved":{"type":"boolean"},"resolvedById":{"type":["null","string"]},"resolvedAt":{"type":["null","string"]},"createdAt":{"type":"string"}}}}}}}}},"/api/v1/ai/models":{"get":{"summary":"List model registry","tags":["AI Intelligence"],"description":"Returns all registered ML models with their versions, status, performance metrics, and training metadata.","responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"modelName":{"type":"string"},"version":{"type":"string"},"status":{"type":"string"},"metrics":{"type":"object"},"hyperparameters":{"type":"object"},"trainingDataRange":{"type":"object"},"artifactPath":{"type":"string"},"trainedAt":{"type":"string"},"activatedAt":{"type":["null","string"]},"createdAt":{"type":"string"}}}}}}}}}}}},"/api/v1/ai/models/{name}/retrain":{"post":{"summary":"Trigger model retraining","tags":["AI Intelligence"],"description":"Initiates a manual retraining for the specified model. Creates a new version entry in TRAINING status. This is a mock operation that immediately creates the training record.","parameters":[{"schema":{"type":"string"},"in":"path","name":"name","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"modelName":{"type":"string"},"version":{"type":"string"},"status":{"type":"string"},"metrics":{"type":"object"},"hyperparameters":{"type":"object"},"trainingDataRange":{"type":"object"},"artifactPath":{"type":"string"},"trainedAt":{"type":"string"},"activatedAt":{"type":["null","string"]},"createdAt":{"type":"string"},"message":{"type":"string"}}}}}}}}},"/api/v1/ai/matching/scores":{"get":{"summary":"Get neural match scores","tags":["AI Intelligence"],"description":"Returns match scores and factor breakdowns for current PROPOSED and AUTO_CONFIRMED SO-PO matches. Scores are generated by the match_scorer neural network.","parameters":[{"schema":{"type":"number","default":1},"in":"query","name":"page","required":false},{"schema":{"type":"number","default":20},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"matchId":{"type":"string"},"salesOrderId":{"type":"string"},"purchaseOrderId":{"type":"string"},"skuId":{"type":"string"},"matchScore":{"type":"number"},"matchFactors":{"type":"object"},"status":{"type":"string"},"proposedBy":{"type":"string"}}}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"limit":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}}}}}}}}}}},"/api/v1/ai/insights/season/{season}/{year}":{"get":{"summary":"Get seasonal AI insights","tags":["AI Intelligence"],"description":"Returns a comprehensive AI insights summary for a given season and year, including demand forecasts, recommendation statistics, anomaly breakdown, matching performance, and historical sales context.","parameters":[{"schema":{"type":"string"},"in":"path","name":"season","required":true},{"schema":{"type":"number"},"in":"path","name":"year","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"season":{"type":"string"},"year":{"type":"number"},"demandSummary":{"type":"object","properties":{"totalForecastedUnits":{"type":"number"},"topSkus":{"type":"array","items":{"type":"object"}},"avgConfidence":{"type":"number"}}},"recommendations":{"type":"object","properties":{"total":{"type":"number"},"pending":{"type":"number"},"accepted":{"type":"number"},"dismissed":{"type":"number"},"byType":{"type":"object"}}},"anomalies":{"type":"object","properties":{"total":{"type":"number"},"unresolved":{"type":"number"},"bySeverity":{"type":"object"}}},"matchingPerformance":{"type":"object","properties":{"totalMatches":{"type":"number"},"avgScore":{"type":"number"},"autoConfirmRate":{"type":"number"}}}}}}}}}}},"/api/v1/reports/seasonal-buy-summary":{"get":{"summary":"Seasonal buy summary","tags":["Reports"],"description":"Returns PO spend versus budget breakdown by season, category, and supplier. Includes status distribution of purchase orders.","parameters":[{"schema":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"in":"query","name":"season","required":false},{"schema":{"type":"number"},"in":"query","name":"seasonYear","required":false},{"schema":{"type":"string"},"in":"query","name":"category","required":false},{"schema":{"type":"string"},"in":"query","name":"supplierId","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"season":{"type":"string"},"seasonYear":{"type":["null","number"]},"totalBudget":{"type":"number"},"totalSpend":{"type":"number"},"remainingBudget":{"type":"number"},"utilizationPercent":{"type":"number"},"byCategory":{"type":"array","items":{"type":"object"}},"bySupplier":{"type":"array","items":{"type":"object"}},"byStatus":{"type":"object"}}}}}}}}},"/api/v1/reports/open-to-buy":{"get":{"summary":"Open-to-buy report","tags":["Reports"],"description":"Shows remaining budget by category for the specified season. Calculates committed spend from active purchase orders against category-level budgets.","parameters":[{"schema":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"in":"query","name":"season","required":false},{"schema":{"type":"number"},"in":"query","name":"seasonYear","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"season":{"type":"string"},"seasonYear":{"type":["null","number"]},"categories":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string"},"budget":{"type":"number"},"committed":{"type":"number"},"remaining":{"type":"number"},"utilizationPercent":{"type":"number"}}}},"total":{"type":"object","properties":{"budget":{"type":"number"},"committed":{"type":"number"},"remaining":{"type":"number"},"utilizationPercent":{"type":"number"}}}}}}}}}}},"/api/v1/reports/sell-through":{"get":{"summary":"Sell-through analysis","tags":["Reports"],"description":"Calculates sell-through rates (units sold / units received) broken down by channel and category. Supports filtering by channel, category, and season.","parameters":[{"schema":{"type":"string"},"in":"query","name":"channel","required":false},{"schema":{"type":"string"},"in":"query","name":"category","required":false},{"schema":{"type":"string","enum":["SS","AW","RESORT","PRE_FALL","CAPSULE"]},"in":"query","name":"season","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"overall":{"type":"object","properties":{"unitsSold":{"type":"number"},"unitsReceived":{"type":"number"},"sellThroughRate":{"type":"number"}}},"byChannel":{"type":"array","items":{"type":"object"}},"byCategory":{"type":"array","items":{"type":"object"}}}}}}}}}},"/api/v1/reports/fulfillment-sla":{"get":{"summary":"Fulfillment SLA compliance","tags":["Reports"],"description":"Reports the percentage of orders shipped within the target SLA window. Default target is 3 days. Breakdown by channel included.","parameters":[{"schema":{"type":"string"},"in":"query","name":"channel","required":false},{"schema":{"type":"number","default":3},"in":"query","name":"targetDays","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"targetDays":{"type":"number"},"totalOrders":{"type":"number"},"withinSla":{"type":"number"},"outsideSla":{"type":"number"},"slaPercent":{"type":"number"},"avgFulfillmentDays":{"type":"number"},"byChannel":{"type":"array","items":{"type":"object"}}}}}}}}}},"/api/v1/reports/gross-margin":{"get":{"summary":"Gross margin report","tags":["Reports"],"description":"Calculates revenue minus COGS (cost of goods sold) with margin percentages. Breakdowns by sales channel and product category.","parameters":[{"schema":{"type":"string"},"in":"query","name":"channel","required":false},{"schema":{"type":"string"},"in":"query","name":"category","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"overall":{"type":"object","properties":{"revenue":{"type":"number"},"cogs":{"type":"number"},"grossMargin":{"type":"number"},"marginPercent":{"type":"number"}}},"byChannel":{"type":"array","items":{"type":"object"}},"byCategory":{"type":"array","items":{"type":"object"}}}}}}}}}},"/api/v1/reports/supplier-performance":{"get":{"summary":"Supplier performance scorecard","tags":["Reports"],"description":"Evaluates supplier performance including on-time delivery rate, average lead time, defect rate, total units ordered/received, and total spend.","parameters":[{"schema":{"type":"string"},"in":"query","name":"supplierId","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"suppliers":{"type":"array","items":{"type":"object","properties":{"supplierId":{"type":"string"},"supplierName":{"type":"string"},"totalPOs":{"type":"number"},"onTimeDeliveryRate":{"type":"number"},"avgLeadTimeDays":{"type":"number"},"defectRate":{"type":"number"},"totalUnitsOrdered":{"type":"number"},"totalUnitsReceived":{"type":"number"},"totalSpend":{"type":"number"}}}}}}}}}}}},"/api/v1/reports/stock-aging":{"get":{"summary":"Stock aging analysis","tags":["Reports"],"description":"Analyzes inventory age distribution across aging buckets (0-30, 31-60, 61-90, 91-180, 180+ days). Shows the oldest stock items by SKU and location.","parameters":[{"schema":{"type":"string"},"in":"query","name":"locationId","required":false},{"schema":{"type":"string"},"in":"query","name":"category","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"agingBuckets":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"skuCount":{"type":"number"},"totalUnits":{"type":"number"},"totalValue":{"type":"number"}}}},"topAging":{"type":"array","items":{"type":"object"}}}}}}}}}},"/api/v1/reports/match-health":{"get":{"summary":"SO-PO match health dashboard","tags":["Reports"],"description":"Reports overall match rate, auto-confirm rate, average match score, status distribution, and recent matching run history.","responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"totalMatches":{"type":"number"},"matchRate":{"type":"number"},"autoConfirmRate":{"type":"number"},"avgMatchScore":{"type":"number"},"byStatus":{"type":"object"},"recentRuns":{"type":"array","items":{"type":"object"}}}}}}}}}},"/api/v1/reports/executive-kpis":{"get":{"summary":"Executive KPI dashboard","tags":["Reports"],"description":"Returns a comprehensive KPI dashboard including revenue by channel, inventory levels and value, order counts, supplier/location stats, and AI system health metrics.","responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"revenue":{"type":"object"},"inventory":{"type":"object"},"orders":{"type":"object"},"supply":{"type":"object"},"aiHealth":{"type":"object"},"generatedAt":{"type":"string"}}}}}}}}},"/external/":{"get":{"summary":"External API directory — lists all mock external systems with descriptions and base URLs","tags":["External API Directory"],"description":"Returns a machine-readable directory of all 11 external system mock APIs. Each entry describes what the system does, what data it serves, its base URL, authentication method, and available endpoints. Designed for AI agent discovery.","responses":{"200":{"description":"Default Response"}}}},"/external/sfcc/shop/v24_5/organizations/acne-studios/products/{productId}":{"get":{"summary":"Get product by style number","tags":["External: SFCC"],"description":"Returns a single product in SFCC Shopper API format. Uses the IMS style number as the SFCC product ID. Includes all colour/size variants.","parameters":[{"schema":{"type":"string"},"in":"path","name":"productId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/sfcc/shop/v24_5/organizations/acne-studios/products":{"get":{"summary":"Search products","tags":["External: SFCC"],"description":"Search products by keyword, category, with sorting and pagination. Returns hits in SFCC product_search_result format.","parameters":[{"schema":{"type":"string"},"in":"query","name":"q","required":false,"description":"Search query string"},{"schema":{"type":"string"},"in":"query","name":"categoryId","required":false,"description":"Filter by category ID"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results to return (default 25)"},{"schema":{"type":"string"},"in":"query","name":"offset","required":false,"description":"Offset for pagination (default 0)"},{"schema":{"type":"string"},"in":"query","name":"sort","required":false,"description":"Sort field and direction (e.g. price-asc, name-desc)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/sfcc/shop/v24_5/organizations/acne-studios/categories/{categoryId}":{"get":{"summary":"Get category by ID","tags":["External: SFCC"],"description":"Returns a single category derived from IMS product categories. Includes sub-categories.","parameters":[{"schema":{"type":"string"},"in":"path","name":"categoryId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/sfcc/shop/v24_5/organizations/acne-studios/categories":{"get":{"summary":"List all categories","tags":["External: SFCC"],"description":"Returns all product categories derived from the IMS product catalog. Categories are dynamically built from product data.","responses":{"200":{"description":"Default Response"}}}},"/external/sfcc/shop/v24_5/organizations/acne-studios/baskets":{"get":{"summary":"List all baskets","tags":["External: SFCC"],"description":"List all shopping baskets including pre-seeded abandoned carts and active sessions. Returns baskets sorted by creation date (newest first).","parameters":[{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results (default 50)"},{"schema":{"type":"string"},"in":"query","name":"offset","required":false,"description":"Offset for pagination (default 0)"}],"responses":{"200":{"description":"Default Response"}}},"post":{"summary":"Create a new basket","tags":["External: SFCC"],"description":"Creates an empty shopping basket with the specified currency. Baskets are stored in-memory and can be converted to orders.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"currency":{"type":"string","description":"Currency code (default EUR)"}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/external/sfcc/shop/v24_5/organizations/acne-studios/baskets/{basketId}/items":{"post":{"summary":"Add item to basket","tags":["External: SFCC"],"description":"Adds a product to the basket by style number. If the product already exists in the basket, the quantity is incremented.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"productId":{"type":"string","description":"Product style number"},"quantity":{"type":"number","description":"Quantity to add (default 1)"}},"required":["productId"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"basketId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/sfcc/shop/v24_5/organizations/acne-studios/baskets/{basketId}":{"get":{"summary":"Get basket by ID","tags":["External: SFCC"],"description":"Returns the basket with all items and computed order total.","parameters":[{"schema":{"type":"string"},"in":"path","name":"basketId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/sfcc/shop/v24_5/organizations/acne-studios/orders":{"post":{"summary":"Create order from basket","tags":["External: SFCC"],"description":"Converts a basket into a sales order. Creates a CONFIRMED sales order in the IMS store with channel=ECOMMERCE. The basket is removed after order creation.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"basketId":{"type":"string","description":"ID of the basket to convert"}},"required":["basketId"]}}}},"responses":{"200":{"description":"Default Response"}}},"get":{"summary":"List all e-commerce orders","tags":["External: SFCC"],"description":"List all ECOMMERCE-channel orders from the IMS in SFCC format. Supports filtering by status and pagination.","parameters":[{"schema":{"type":"string"},"in":"query","name":"status","required":false,"description":"Filter by order status (e.g. shipped, delivered)"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results (default 50)"},{"schema":{"type":"string"},"in":"query","name":"offset","required":false,"description":"Offset for pagination (default 0)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/sfcc/shop/v24_5/organizations/acne-studios/orders/{orderId}":{"get":{"summary":"Get order by ID","tags":["External: SFCC"],"description":"Returns an order in SFCC format. Looks up the order by IMS ID or SO number. Maps IMS sales order data to SFCC order format.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orderId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/teamwork/api/v2/orders":{"get":{"summary":"List orders","tags":["External: Teamwork"],"description":"List all orders with optional filters for status and location. Maps from IMS sales orders. Returns Teamwork camelCase format.","parameters":[{"schema":{"type":"string"},"in":"query","name":"status","required":false,"description":"Filter by order status (e.g. CONFIRMED, SHIPPED)"},{"schema":{"type":"string"},"in":"query","name":"locationId","required":false,"description":"Filter by fulfillment location ID"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results (default 50)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/teamwork/api/v2/orders/{id}":{"get":{"summary":"Get order detail","tags":["External: Teamwork"],"description":"Returns full order details including line items with SKU info. Maps from IMS sales order data.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/teamwork/api/v2/orders/{id}/fulfill":{"post":{"summary":"Mark order as fulfilled","tags":["External: Teamwork"],"description":"Transitions the order to SHIPPED status in the IMS store. Creates a shipment record and marks all line items as shipped. Valid from ALLOCATED, PICKING, or PACKED status.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/teamwork/api/v2/orders/{id}/cancel":{"post":{"summary":"Cancel order","tags":["External: Teamwork"],"description":"Cancels an order by transitioning it to CANCELLED status. Not allowed for orders that have already been SHIPPED, DELIVERED, or RETURNED.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/teamwork/api/v2/orders/{id}/route":{"post":{"summary":"Route order to optimal fulfillment location","tags":["External: Teamwork"],"description":"Analyzes stock availability across all locations and routes the order to the location that can fulfill the most line items. Updates the order locationId in the IMS store.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/teamwork/api/v2/locations":{"get":{"summary":"List all locations","tags":["External: Teamwork"],"description":"Returns all locations from the IMS store including stores, warehouses, and DCs.","responses":{"200":{"description":"Default Response"}}}},"/external/teamwork/api/v2/locations/{id}":{"get":{"summary":"Get location detail","tags":["External: Teamwork"],"description":"Returns full details for a specific location.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/teamwork/api/v2/transactions":{"get":{"summary":"List POS transactions","tags":["External: Teamwork"],"description":"Returns POS transaction records across stores for the last 30 days. Generated from IMS retail sales orders plus synthetic transactions. Each transaction includes store, terminal, cashier, items, payment method, and total.","parameters":[{"schema":{"type":"string"},"in":"query","name":"storeId","required":false,"description":"Filter by store location ID"},{"schema":{"type":"string"},"in":"query","name":"transactionType","required":false,"description":"Filter by type: sale, return, exchange"},{"schema":{"type":"string"},"in":"query","name":"paymentMethod","required":false,"description":"Filter by payment: card, cash, klarna"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results (default 100)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/teamwork/api/v2/inventory":{"get":{"summary":"Inventory lookup","tags":["External: Teamwork"],"description":"Query stock levels by SKU ID and/or location ID. Maps from IMS stock level data with computed available quantity.","parameters":[{"schema":{"type":"string"},"in":"query","name":"skuId","required":false,"description":"Filter by SKU ID"},{"schema":{"type":"string"},"in":"query","name":"locationId","required":false,"description":"Filter by location ID"}],"responses":{"200":{"description":"Default Response"}}}},"/external/blue-yonder/api/v1/inbound-orders":{"get":{"summary":"List inbound purchase orders","tags":["External: Blue Yonder"],"description":"Lists purchase orders destined for warehouse locations. Maps from IMS POs where deliveryLocationId is a warehouse or DC. Uses Blue Yonder PascalCase response format.","parameters":[{"schema":{"type":"string"},"in":"query","name":"warehouseId","required":false,"description":"Filter by warehouse location ID"},{"schema":{"type":"string"},"in":"query","name":"status","required":false,"description":"Filter by PO status (e.g. SHIPPED, RECEIVED)"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results (default 50)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/blue-yonder/api/v1/inbound-orders/{id}":{"get":{"summary":"Get inbound order detail","tags":["External: Blue Yonder"],"description":"Returns full inbound order details including line items and receipt history. Maps from an IMS purchase order.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/blue-yonder/api/v1/inbound-orders/{id}/receive":{"post":{"summary":"Record receipt of goods","tags":["External: Blue Yonder"],"description":"Records receipt of goods for an inbound PO. Creates POReceipt records in the IMS store, updates PO line quantities, and adjusts stock levels at the warehouse. If no lines are specified, receives all remaining quantities.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lines":{"type":"array","items":{"type":"object","properties":{"poLineId":{"type":"string"},"quantityReceived":{"type":"number"},"qualityStatus":{"type":"string","description":"PASSED or FAILED (default PASSED)"},"damagedQuantity":{"type":"number","description":"Number of damaged units (default 0)"},"notes":{"type":"string"}},"required":["poLineId","quantityReceived"]}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/blue-yonder/api/v1/stock-on-hand":{"get":{"summary":"Query stock levels at warehouses","tags":["External: Blue Yonder"],"description":"Returns stock on hand at warehouse locations. Filter by SKU ID/code and/or warehouse ID.","parameters":[{"schema":{"type":"string"},"in":"query","name":"sku","required":false,"description":"SKU ID or SKU code to look up"},{"schema":{"type":"string"},"in":"query","name":"warehouseId","required":false,"description":"Filter by warehouse location ID"}],"responses":{"200":{"description":"Default Response"}}}},"/external/blue-yonder/api/v1/outbound-orders":{"post":{"summary":"Create pick/pack/ship order from SO","tags":["External: Blue Yonder"],"description":"Creates an outbound order for warehouse fulfillment from an IMS sales order. Transitions the SO to PICKING status. Lines are created from the SO line items.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"salesOrderId":{"type":"string","description":"IMS sales order ID"},"warehouseId":{"type":"string","description":"Override warehouse (defaults to SO locationId)"}},"required":["salesOrderId"]}}}},"responses":{"200":{"description":"Default Response"}}},"get":{"summary":"List outbound orders","tags":["External: Blue Yonder"],"description":"Lists outbound orders including both explicitly created ones and virtual orders mapped from IMS SOs in PICKING/PACKED/SHIPPED status.","parameters":[{"schema":{"type":"string"},"in":"query","name":"warehouseId","required":false,"description":"Filter by warehouse ID"},{"schema":{"type":"string"},"in":"query","name":"status","required":false,"description":"Filter by status (CREATED, PICKING, PACKED, SHIPPED)"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results (default 50)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/blue-yonder/api/v1/outbound-orders/{id}":{"get":{"summary":"Get outbound order detail","tags":["External: Blue Yonder"],"description":"Returns full details for an outbound order including all lines.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/blue-yonder/api/v1/outbound-orders/{id}/ship":{"post":{"summary":"Confirm shipment","tags":["External: Blue Yonder"],"description":"Confirms shipment of an outbound order. Updates the outbound order to SHIPPED, creates a shipment record in the IMS store, and transitions the sales order to SHIPPED.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"trackingNumber":{"type":"string","description":"Shipment tracking number"},"carrier":{"type":"string","description":"Shipping carrier name"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/blue-yonder/api/v1/pick-tasks":{"get":{"summary":"List active pick tasks","tags":["External: Blue Yonder"],"description":"Returns pick tasks for warehouse workers generated from IMS sales orders in PICKING/ALLOCATED status. Each task includes bin locations, picked quantities, and assigned worker. Also includes recently completed pick tasks from shipped orders.","parameters":[{"schema":{"type":"string"},"in":"query","name":"warehouseId","required":false,"description":"Filter by warehouse location ID"},{"schema":{"type":"string"},"in":"query","name":"status","required":false,"description":"Filter by status: Assigned, InProgress, Completed"},{"schema":{"type":"string"},"in":"query","name":"assignedTo","required":false,"description":"Filter by worker name (partial match)"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results (default 50)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/blue-yonder/api/v1/warehouses":{"get":{"summary":"List warehouse locations","tags":["External: Blue Yonder"],"description":"Returns all warehouse and DC locations with stock summary information including total SKU count, on-hand quantities, and available inventory.","responses":{"200":{"description":"Default Response"}}}},"/external/temera/api/v1/passports":{"get":{"summary":"List digital product passports","tags":["External: Temera DPP"],"description":"Returns all DPPs. Filter by productId, season, status. Temera DPP provides EU-regulation-compliant digital product passports for every garment, linked via NFC tags and QR codes.","parameters":[{"schema":{"type":"string"},"in":"query","name":"productId","required":false},{"schema":{"type":"string"},"in":"query","name":"season","required":false},{"schema":{"type":"string","enum":["draft","active","archived"]},"in":"query","name":"status","required":false},{"schema":{"type":"number","default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"number","default":0},"in":"query","name":"offset","required":false}],"responses":{"200":{"description":"Default Response"}}},"post":{"summary":"Create a new digital product passport","tags":["External: Temera DPP"],"description":"Creates a DPP for a product/SKU. Links to NFC tag and generates QR code URL.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["skuId"],"properties":{"skuId":{"type":"string"},"serialNumber":{"type":"string"},"nfcTagId":{"type":"string"}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/external/temera/api/v1/passports/{passportId}":{"get":{"summary":"Get digital product passport by ID","tags":["External: Temera DPP"],"description":"Returns full DPP with materials, supply chain events, sustainability data, care instructions, and compliance status.","parameters":[{"schema":{"type":"string"},"in":"path","name":"passportId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/temera/api/v1/passports/nfc/{nfcTagId}":{"get":{"summary":"Look up passport by NFC tag ID","tags":["External: Temera DPP"],"description":"Simulates scanning an NFC tag on a garment to retrieve its digital product passport.","parameters":[{"schema":{"type":"string"},"in":"path","name":"nfcTagId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/temera/api/v1/passports/{passportId}/verify":{"get":{"summary":"Verify passport authenticity","tags":["External: Temera DPP"],"description":"Blockchain-backed verification of product authenticity and ownership chain.","parameters":[{"schema":{"type":"string"},"in":"path","name":"passportId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/temera/api/v1/passports/{passportId}/events":{"get":{"summary":"List supply chain events for a passport","tags":["External: Temera DPP"],"description":"Returns traceability events: raw material sourcing, manufacturing, shipping, retail arrival.","parameters":[{"schema":{"type":"string"},"in":"path","name":"passportId","required":true}],"responses":{"200":{"description":"Default Response"}}},"post":{"summary":"Add supply chain event to passport","tags":["External: Temera DPP"],"description":"Record a new traceability event (e.g., garment shipped, arrived at store).","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["eventType","location"],"properties":{"eventType":{"type":"string","enum":["raw_material_sourced","manufacturing_started","manufacturing_completed","quality_check_passed","shipped","customs_cleared","warehouse_received","store_received","sold","returned","resold","recycled"]},"location":{"type":"string"},"details":{"type":"object"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"passportId","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/temera/api/v1/compliance/status":{"get":{"summary":"Get EU DPP compliance status","tags":["External: Temera DPP"],"description":"Returns overall compliance status for the EU Digital Product Passport regulation (ESPR). Shows which products have DPPs, which are pending, and compliance deadlines.","responses":{"200":{"description":"Default Response"}}}},"/external/temera/api/v1/materials":{"get":{"summary":"List materials with sustainability data","tags":["External: Temera DPP"],"description":"Returns materials used across products with origin, certifications, carbon footprint, and recyclability information.","parameters":[{"schema":{"type":"string"},"in":"query","name":"category","required":false},{"schema":{"type":"boolean"},"in":"query","name":"certified","required":false},{"schema":{"type":"number","default":50},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response"}}}},"/external/d365/data/$metadata":{"get":{"summary":"Get OData metadata document","tags":["External: D365"],"description":"Returns the OData $metadata XML document describing all available entities, their properties, and relationships. Follows the Dynamics 365 Finance & Operations OData v4 pattern.","responses":{"200":{"description":"Default Response"}}}},"/external/d365/data/":{"get":{"summary":"List available OData entity sets","tags":["External: D365"],"description":"Returns the OData service document listing all available entity collections.","responses":{"200":{"description":"Default Response"}}}},"/external/d365/data/Vendors":{"get":{"summary":"List vendors","tags":["External: D365"],"description":"OData entity: Vendors. Maps to IMS suppliers. Supports $top, $skip, $filter, $select, $orderby, $count, cross-company.","parameters":[{"schema":{"type":"number"},"in":"query","name":"$top","required":false},{"schema":{"type":"number"},"in":"query","name":"$skip","required":false},{"schema":{"type":"string"},"in":"query","name":"$filter","required":false},{"schema":{"type":"string"},"in":"query","name":"$select","required":false},{"schema":{"type":"string"},"in":"query","name":"$orderby","required":false},{"schema":{"type":"boolean"},"in":"query","name":"$count","required":false},{"schema":{"type":"boolean"},"in":"query","name":"cross-company","required":false}],"responses":{"200":{"description":"Default Response"}}}},"/external/d365/data/Vendors{regexp1}":{"get":{"summary":"Get vendor by key","tags":["External: D365"],"description":"Retrieve a single vendor entity. Key format: VendorAccountNumber='SUP-TI',dataAreaId='acse'","parameters":[{"schema":{"type":"string"},"in":"path","name":"key","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/d365/data/PurchaseOrderHeaders":{"get":{"summary":"List purchase order headers","tags":["External: D365"],"description":"OData entity: PurchaseOrderHeaders. Maps to IMS purchase orders. Supports $top, $skip, $filter, $expand=PurchaseOrderLines.","parameters":[{"schema":{"type":"number"},"in":"query","name":"$top","required":false},{"schema":{"type":"number"},"in":"query","name":"$skip","required":false},{"schema":{"type":"string"},"in":"query","name":"$filter","required":false},{"schema":{"type":"string"},"in":"query","name":"$select","required":false},{"schema":{"type":"string"},"in":"query","name":"$expand","required":false},{"schema":{"type":"string"},"in":"query","name":"$orderby","required":false}],"responses":{"200":{"description":"Default Response"}}}},"/external/d365/data/PurchaseOrderHeaders{regexp1}":{"get":{"summary":"Get purchase order by key","tags":["External: D365"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"key","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/d365/data/SalesOrderHeaders":{"get":{"summary":"List sales order headers","tags":["External: D365"],"description":"OData entity: SalesOrderHeaders. Maps to IMS sales orders. Supports $expand=SalesOrderLines.","parameters":[{"schema":{"type":"number"},"in":"query","name":"$top","required":false},{"schema":{"type":"number"},"in":"query","name":"$skip","required":false},{"schema":{"type":"string"},"in":"query","name":"$filter","required":false},{"schema":{"type":"string"},"in":"query","name":"$select","required":false},{"schema":{"type":"string"},"in":"query","name":"$expand","required":false},{"schema":{"type":"string"},"in":"query","name":"$orderby","required":false}],"responses":{"200":{"description":"Default Response"}}}},"/external/d365/data/SalesOrderHeaders{regexp1}":{"get":{"summary":"Get sales order by key","tags":["External: D365"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"key","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/d365/data/ReleasedProducts":{"get":{"summary":"List released products","tags":["External: D365"],"description":"OData entity: ReleasedProducts. Maps to IMS products/SKUs with D365-specific fields (ItemNumber, ProductType, ItemModelGroup).","parameters":[{"schema":{"type":"number"},"in":"query","name":"$top","required":false},{"schema":{"type":"number"},"in":"query","name":"$skip","required":false},{"schema":{"type":"string"},"in":"query","name":"$filter","required":false},{"schema":{"type":"string"},"in":"query","name":"$select","required":false}],"responses":{"200":{"description":"Default Response"}}}},"/external/d365/data/ReleasedProducts{regexp1}":{"get":{"summary":"Get released product by key","tags":["External: D365"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"key","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/d365/data/InventoryOnHand":{"get":{"summary":"List inventory on-hand","tags":["External: D365"],"description":"OData entity: InventoryOnHand. Real-time stock position per item/warehouse. Maps to IMS stock levels.","parameters":[{"schema":{"type":"number"},"in":"query","name":"$top","required":false},{"schema":{"type":"number"},"in":"query","name":"$skip","required":false},{"schema":{"type":"string"},"in":"query","name":"$filter","required":false}],"responses":{"200":{"description":"Default Response"}}}},"/external/d365/data/Customers":{"get":{"summary":"List customers","tags":["External: D365"],"description":"OData entity: Customers. Maps to IMS sales order customer data and wholesale buyers.","parameters":[{"schema":{"type":"number"},"in":"query","name":"$top","required":false},{"schema":{"type":"number"},"in":"query","name":"$skip","required":false},{"schema":{"type":"string"},"in":"query","name":"$filter","required":false},{"schema":{"type":"string"},"in":"query","name":"$select","required":false}],"responses":{"200":{"description":"Default Response"}}}},"/external/d365/data/Customers{regexp1}":{"get":{"summary":"Get customer by key","tags":["External: D365"],"parameters":[{"schema":{"type":"string"},"in":"path","name":"key","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/d365/data/GeneralJournalEntries":{"get":{"summary":"List general journal entries","tags":["External: D365"],"description":"OData entity: GeneralJournalEntries. GL entries generated from PO receipts and SO shipments.","parameters":[{"schema":{"type":"number","default":20},"in":"query","name":"$top","required":false},{"schema":{"type":"number","default":0},"in":"query","name":"$skip","required":false},{"schema":{"type":"string"},"in":"query","name":"$filter","required":false}],"responses":{"200":{"description":"Default Response"}}}},"/external/d365/data/ExchangeRates":{"get":{"summary":"List currency exchange rates","tags":["External: D365"],"description":"OData entity: ExchangeRates. SEK-based exchange rates used for multi-currency operations.","responses":{"200":{"description":"Default Response"}}}},"/external/nedap/api/v2/articles":{"get":{"summary":"List articles","tags":["External: Nedap"],"description":"List articles (products) with RFID-relevant fields. Maps products from IMS store with GTIN barcodes. Follows GS1 EPCIS 1.2 standard.","parameters":[{"schema":{"type":"string"},"in":"query","name":"gtin","required":false,"description":"Filter by GTIN barcode"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results (default 50, max 100)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/nedap/api/v2/articles/{gtin}":{"get":{"summary":"Get article by GTIN","tags":["External: Nedap"],"description":"Get a single article by its GTIN/barcode. Returns RFID tag and EPC data.","parameters":[{"schema":{"type":"string"},"in":"path","name":"gtin","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/nedap/api/v2/epc-observations":{"get":{"summary":"List EPC tag observations","tags":["External: Nedap"],"description":"List RFID tag read observations. Returns EPC, timestamp, zone, and location. Generated from real SKU rfidTag fields in IMS store data.","parameters":[{"schema":{"type":"string"},"in":"query","name":"locationId","required":false,"description":"Filter by location ID"},{"schema":{"type":"string"},"in":"query","name":"since","required":false,"description":"ISO timestamp — return observations after this time"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results (default 50, max 500)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/nedap/api/v2/stock-counts":{"post":{"summary":"Submit stock count","tags":["External: Nedap"],"description":"Submit a stock count from a store. Compares with system stock, flags discrepancies, and creates RFID_RECONCILIATION movements in IMS. Includes deliberate 2-5% discrepancies for reconciliation testing.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["locationId","countedAt","items"],"properties":{"locationId":{"type":"string"},"countedAt":{"type":"string","format":"date-time"},"items":{"type":"array","items":{"type":"object","required":["gtin","epc","quantity"],"properties":{"gtin":{"type":"string"},"epc":{"type":"string"},"quantity":{"type":"number"}}}}}}}}},"responses":{"200":{"description":"Default Response"}}},"get":{"summary":"List stock counts","tags":["External: Nedap"],"description":"List previous stock count results with summary data. Supports filtering by location.","parameters":[{"schema":{"type":"string"},"in":"query","name":"locationId","required":false,"description":"Filter by location ID"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results (default 50, max 100)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/nedap/api/v2/stock-counts/{id}":{"get":{"summary":"Get stock count detail","tags":["External: Nedap"],"description":"Get a single stock count with per-item results and discrepancy breakdown.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/nedap/api/v2/stock-accuracy":{"get":{"summary":"Stock accuracy KPIs","tags":["External: Nedap"],"description":"Stock accuracy KPIs per location. Returns accuracy percentage, total items, matched items, and discrepancies for RFID-enabled stores.","parameters":[{"schema":{"type":"string"},"in":"query","name":"locationId","required":false,"description":"Filter to a specific location"}],"responses":{"200":{"description":"Default Response"}}}},"/external/nedap/api/v2/locations":{"get":{"summary":"List RFID-enabled locations","tags":["External: Nedap"],"description":"List all RFID-enabled locations (stores only from IMS). Includes reader count, zone count, and last sync timestamp.","responses":{"200":{"description":"Default Response"}}}},"/external/nuorder/api/v1/orders":{"get":{"summary":"List wholesale orders","tags":["External: NuORDER"],"description":"List wholesale orders. Maps from IMS wholesale sales orders. Uses OAuth 1.0 authentication (mock). Response uses snake_case flat JSON.","parameters":[{"schema":{"type":"string","enum":["new","processing","shipped","cancelled"]},"in":"query","name":"status","required":false,"description":"Filter by order status"},{"schema":{"type":"string"},"in":"query","name":"buyer_code","required":false,"description":"Filter by buyer company code"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results (default 50, max 100)"}],"responses":{"200":{"description":"Default Response"}}},"post":{"summary":"Create wholesale order","tags":["External: NuORDER"],"description":"Create a wholesale order. Creates a corresponding WHOLESALE sales order in IMS. Body requires buyer info, line items with SKU references, and ship-to address.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["buyer","items","ship_to"],"properties":{"buyer":{"type":"object","required":["name","code","email"],"properties":{"name":{"type":"string"},"code":{"type":"string"},"email":{"type":"string"}}},"items":{"type":"array","items":{"type":"object","required":["sku","quantity"],"properties":{"sku":{"type":"string"},"quantity":{"type":"number"}}}},"ship_to":{"type":"object","required":["address","city","country"],"properties":{"address":{"type":"string"},"city":{"type":"string"},"country":{"type":"string"}}}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/external/nuorder/api/v1/orders/{id}":{"get":{"summary":"Get order detail","tags":["External: NuORDER"],"description":"Get wholesale order detail with line items, buyer info, and ship-to address.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/nuorder/api/v1/orders/{id}/status":{"put":{"summary":"Update order status","tags":["External: NuORDER"],"description":"Update a wholesale order status. Maps to IMS sales order state transitions. Valid statuses: new, processing, shipped, cancelled.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["new","processing","shipped","cancelled"]}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/nuorder/api/v1/line-sheets":{"get":{"summary":"List line sheets","tags":["External: NuORDER"],"description":"List line sheets (seasonal product catalogs). Generated from IMS products grouped by season.","responses":{"200":{"description":"Default Response"}}}},"/external/nuorder/api/v1/line-sheets/{seasonYear}":{"get":{"summary":"Get line sheet","tags":["External: NuORDER"],"description":"Get line sheet for a specific season. Returns products with wholesale pricing, images, sizes, and color options. Format: AW2026 or SS2026.","parameters":[{"schema":{"type":"string"},"in":"path","name":"seasonYear","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/nuorder/api/v1/products":{"get":{"summary":"List products","tags":["External: NuORDER"],"description":"List products with wholesale details including pricing and size runs. Supports filtering by season and category.","parameters":[{"schema":{"type":"string"},"in":"query","name":"season","required":false,"description":"Filter by season (e.g. AW2026, SS)"},{"schema":{"type":"string"},"in":"query","name":"category","required":false,"description":"Filter by category"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results (default 50, max 100)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/nuorder/api/v1/products/{styleNumber}":{"get":{"summary":"Get product by style number","tags":["External: NuORDER"],"description":"Get product detail with wholesale pricing, size runs, and color options. Use the full style number (e.g. FN-WN-COAT000001).","parameters":[{"schema":{"type":"string"},"in":"path","name":"styleNumber","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/nuorder/api/v1/companies":{"get":{"summary":"List buyer companies","tags":["External: NuORDER"],"description":"List wholesale buyer companies. Derived from wholesale sales orders' customerName field.","responses":{"200":{"description":"Default Response"}}}},"/external/nuorder/api/v1/companies/{code}":{"get":{"summary":"Get buyer company detail","tags":["External: NuORDER"],"description":"Get buyer company detail with order history. Use the company code (e.g. NORDSTRO, SELFRIDG).","parameters":[{"schema":{"type":"string"},"in":"path","name":"code","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/centric/rest/v2/styles":{"get":{"summary":"List styles","tags":["External: Centric"],"description":"List styles with PLM-specific attributes including tech pack status and sample status. Maps from IMS products. Supports Centric v2 query params: skip, limit, modified_after.","parameters":[{"schema":{"type":"string"},"in":"query","name":"season","required":false,"description":"Filter by season (e.g. AW2026, SS)"},{"schema":{"type":"string"},"in":"query","name":"category","required":false,"description":"Filter by category"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results per page (default 10, max 100)"},{"schema":{"type":"string"},"in":"query","name":"skip","required":false,"description":"Number of records to skip (default 0)"},{"schema":{"type":"string"},"in":"query","name":"modified_after","required":false,"description":"ISO timestamp — return items modified after this date"}],"responses":{"200":{"description":"Default Response"}}}},"/external/centric/rest/v2/styles/{id}":{"get":{"summary":"Get style detail","tags":["External: Centric"],"description":"Get style detail with materials, colorways, size range, and PLM workflow status. Includes material composition and image references.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/centric/rest/v2/style_boms":{"get":{"summary":"List style BOMs (Bill of Materials)","tags":["External: Centric"],"description":"Returns the bill of materials for all styles. Each entry includes the full BOM with materials, quantities, unit costs, and total material cost. Supports filtering by season and category.","parameters":[{"schema":{"type":"string"},"in":"query","name":"season","required":false,"description":"Filter by season (e.g. AW2026, SS)"},{"schema":{"type":"string"},"in":"query","name":"category","required":false,"description":"Filter by category"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results per page (default 100, max 200)"},{"schema":{"type":"string"},"in":"query","name":"skip","required":false,"description":"Number of records to skip (default 0)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/centric/rest/v2/seasons":{"get":{"summary":"List seasons","tags":["External: Centric"],"description":"List seasons derived from IMS product season/year combinations. Includes status (PLANNING, DEVELOPMENT, PRODUCTION, IN_SEASON, ARCHIVED) and style count.","responses":{"200":{"description":"Default Response"}}}},"/external/centric/rest/v2/seasons/{id}":{"get":{"summary":"Get season detail","tags":["External: Centric"],"description":"Get season detail with style count, timeline dates (design through markdown), and list of styles. Season ID format: AW2026, SS2026.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/centric/rest/v2/materials":{"get":{"summary":"List materials","tags":["External: Centric"],"description":"List materials used across products. Generated from product categories (denim, wool, leather, cotton, mohair, etc). Includes composition and certifications.","parameters":[{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results per page (default 10, max 100)"},{"schema":{"type":"string"},"in":"query","name":"skip","required":false,"description":"Number of records to skip (default 0)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/centric/rest/v2/materials/{id}":{"get":{"summary":"Get material detail","tags":["External: Centric"],"description":"Get material detail with supplier info, composition, certifications, and quality test results.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/centric/rest/v2/colorways":{"get":{"summary":"List colorways","tags":["External: Centric"],"description":"List colorways (colors) mapped from acne-colors.json. Includes hex values and associated style counts.","parameters":[{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results per page (default 10, max 100)"},{"schema":{"type":"string"},"in":"query","name":"skip","required":false,"description":"Number of records to skip (default 0)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/centric/rest/v2/collections":{"get":{"summary":"List collections","tags":["External: Centric"],"description":"List collections derived from IMS product collection field. Groups styles by collection name (Main Collection, Face Collection, etc).","parameters":[{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results per page (default 10, max 100)"},{"schema":{"type":"string"},"in":"query","name":"skip","required":false,"description":"Number of records to skip (default 0)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/centric/rest/v2/collections/{id}":{"get":{"summary":"Get collection detail","tags":["External: Centric"],"description":"Get collection detail with list of styles, categories, and seasons. Collection ID format: COL-MAIN-COLLECTION, COL-FACE-COLLECTION, etc.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/external/centric/rest/v2/suppliers":{"get":{"summary":"List suppliers","tags":["External: Centric"],"description":"List suppliers with PLM-specific data including factory audit status, compliance status, and sustainability certifications.","parameters":[{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results per page (default 10, max 100)"},{"schema":{"type":"string"},"in":"query","name":"skip","required":false,"description":"Number of records to skip (default 0)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/centric/rest/v2/size_ranges":{"get":{"summary":"List size ranges","tags":["External: Centric"],"description":"List size ranges used across products. Includes alpha sizes, denim waist sizes, footwear EU sizes, and one-size-fits-all.","parameters":[{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results per page (default 10, max 100)"},{"schema":{"type":"string"},"in":"query","name":"skip","required":false,"description":"Number of records to skip (default 0)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/medius/api/v1/invoices":{"get":{"summary":"List invoices","tags":["External: Medius"],"description":"List all accounts-payable invoices. Filter by supplierId, status (pending/matched/approved/paid/disputed), and limit. Invoices are auto-generated from IMS purchase orders that are RECEIVED or CLOSED.","parameters":[{"schema":{"type":"string"},"in":"query","name":"supplierId","required":false,"description":"Filter by supplier ID"},{"schema":{"type":"string","enum":["pending","matched","approved","paid","disputed"]},"in":"query","name":"status","required":false,"description":"Filter by invoice status"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results to return (default 50)"}],"responses":{"200":{"description":"Default Response"}}},"post":{"summary":"Create invoice","tags":["External: Medius"],"description":"Create a new invoice from a supplier. Can reference a PO number for three-way matching. Created invoices start in \"pending\" status.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["supplierId","invoiceNumber","amount","currency","dueDate"],"properties":{"supplierId":{"type":"string","description":"IMS supplier ID"},"poNumber":{"type":"string","description":"PO number to link for matching"},"invoiceNumber":{"type":"string","description":"Supplier invoice number"},"amount":{"type":"number","description":"Total invoice amount"},"currency":{"type":"string","description":"Currency code (EUR, SEK, USD, etc.)"},"lineItems":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string"},"skuId":{"type":"string"},"quantity":{"type":"number"},"unitPrice":{"type":"number"}}},"description":"Invoice line items"},"dueDate":{"type":"string","format":"date-time","description":"Payment due date"}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/external/medius/api/v1/invoices/{id}":{"get":{"summary":"Get invoice by ID","tags":["External: Medius"],"description":"Returns full invoice detail including line items, PO reference, and three-way matching status.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true,"description":"Invoice ID (e.g. MINV-000001)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/medius/api/v1/invoices/{id}/match":{"post":{"summary":"Three-way match invoice","tags":["External: Medius"],"description":"Performs a three-way match comparing the invoice against the purchase order and goods receipt. Returns match result with any discrepancies found. Successfully matched invoices move to \"matched\" status.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true,"description":"Invoice ID"}],"responses":{"200":{"description":"Default Response"}}}},"/external/medius/api/v1/invoices/{id}/approve":{"post":{"summary":"Approve invoice for payment","tags":["External: Medius"],"description":"Approve a matched invoice for payment processing. Only invoices in \"matched\" status can be approved.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true,"description":"Invoice ID"}],"responses":{"200":{"description":"Default Response"}}}},"/external/medius/api/v1/invoices/{id}/dispute":{"post":{"summary":"Dispute invoice","tags":["External: Medius"],"description":"Dispute an invoice with a reason. Moves the invoice to \"disputed\" status. Cannot dispute already-paid invoices.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["reason"],"properties":{"reason":{"type":"string","description":"Reason for the dispute"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true,"description":"Invoice ID"}],"responses":{"200":{"description":"Default Response"}}}},"/external/medius/api/v1/payments":{"get":{"summary":"List payments","tags":["External: Medius"],"description":"List all payment records. Filter by supplierId, status (scheduled/processing/completed/failed), and limit.","parameters":[{"schema":{"type":"string"},"in":"query","name":"supplierId","required":false,"description":"Filter by supplier ID"},{"schema":{"type":"string","enum":["scheduled","processing","completed","failed"]},"in":"query","name":"status","required":false,"description":"Filter by payment status"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results to return (default 50)"}],"responses":{"200":{"description":"Default Response"}}},"post":{"summary":"Schedule payment","tags":["External: Medius"],"description":"Schedule a payment for an approved invoice. Only invoices in \"approved\" status can have payments scheduled.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["invoiceId"],"properties":{"invoiceId":{"type":"string","description":"Invoice ID to pay"},"paymentMethod":{"type":"string","enum":["bank_transfer","wire","sepa"],"description":"Payment method (default: bank_transfer)"},"scheduledDate":{"type":"string","format":"date-time","description":"Date to process payment"}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/external/medius/api/v1/payments/{id}":{"get":{"summary":"Get payment by ID","tags":["External: Medius"],"description":"Returns full payment detail including bank reference and processing timestamps.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true,"description":"Payment ID (e.g. MPAY-000001)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/medius/api/v1/suppliers/{id}/balance":{"get":{"summary":"Get supplier account balance","tags":["External: Medius"],"description":"Returns the supplier account balance summary including total outstanding, overdue amount, paid this month, and invoice counts.","parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true,"description":"IMS Supplier ID"}],"responses":{"200":{"description":"Default Response"}}}},"/external/adyen/v71/paymentMethods":{"post":{"summary":"Get available payment methods","tags":["External: Payments"],"description":"Returns available payment methods for the given country and amount. Based on Adyen Checkout API v71. Includes Visa, Mastercard, Amex, Klarna, iDEAL, Swish depending on country.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"merchantAccount":{"type":"string","description":"Merchant account name"},"countryCode":{"type":"string","description":"ISO 3166-1 alpha-2 country code (e.g. SE, NL, DE)"},"amount":{"type":"object","properties":{"value":{"type":"number","description":"Amount in minor units (e.g. 10000 = 100.00 EUR)"},"currency":{"type":"string","description":"ISO 4217 currency code"}}}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/external/adyen/v71/payments":{"post":{"summary":"Create payment (Adyen)","tags":["External: Payments"],"description":"Start a payment authorisation. Returns a pspReference and resultCode. Mock always returns Authorised for valid requests. Based on Adyen Checkout API v71.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["amount"],"properties":{"amount":{"type":"object","required":["value","currency"],"properties":{"value":{"type":"number","description":"Amount in minor units"},"currency":{"type":"string","description":"Currency code"}}},"reference":{"type":"string","description":"Merchant reference (e.g. SO number)"},"merchantAccount":{"type":"string","description":"Merchant account name"},"paymentMethod":{"type":"object","properties":{"type":{"type":"string","description":"Payment method type (scheme, ideal, klarna, swish)"},"brand":{"type":"string","description":"Card brand (visa, mastercard, amex)"}}},"returnUrl":{"type":"string","description":"URL to redirect after payment"},"shopperReference":{"type":"string","description":"Unique shopper ID"}}}}}},"responses":{"200":{"description":"Default Response"}}},"get":{"summary":"List all payments (Adyen)","tags":["External: Payments"],"description":"List all payment records with optional filtering by status or merchant reference. This endpoint is mock-only — useful for browsing seeded payment data.","parameters":[{"schema":{"type":"string"},"in":"query","name":"status","required":false,"description":"Filter by status (authorised, captured, refunded, cancelled)"},{"schema":{"type":"string"},"in":"query","name":"merchantReference","required":false,"description":"Filter by merchant reference (e.g. SO number)"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results (default 50, max 100)"},{"schema":{"type":"string"},"in":"query","name":"offset","required":false,"description":"Offset for pagination (default 0)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/adyen/v71/payments/{pspReference}/captures":{"post":{"summary":"Capture payment (Adyen)","tags":["External: Payments"],"description":"Capture a previously authorised payment. Supports partial captures. Based on Adyen Checkout API v71.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["amount"],"properties":{"amount":{"type":"object","required":["value","currency"],"properties":{"value":{"type":"number"},"currency":{"type":"string"}}},"merchantAccount":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"pspReference","required":true,"description":"PSP reference from payment authorisation"}],"responses":{"200":{"description":"Default Response"}}}},"/external/adyen/v71/payments/{pspReference}/refunds":{"post":{"summary":"Refund payment (Adyen)","tags":["External: Payments"],"description":"Refund a captured payment. Supports partial refunds. Based on Adyen Checkout API v71.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["amount"],"properties":{"amount":{"type":"object","required":["value","currency"],"properties":{"value":{"type":"number"},"currency":{"type":"string"}}},"merchantAccount":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"pspReference","required":true,"description":"PSP reference of the captured payment"}],"responses":{"200":{"description":"Default Response"}}}},"/external/adyen/v71/payments/{pspReference}/cancels":{"post":{"summary":"Cancel payment (Adyen)","tags":["External: Payments"],"description":"Cancel an authorised payment that has not been captured. Based on Adyen Checkout API v71.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"merchantAccount":{"type":"string"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"pspReference","required":true,"description":"PSP reference of the authorised payment"}],"responses":{"200":{"description":"Default Response"}}}},"/external/adyen/v71/payments/{pspReference}":{"get":{"summary":"Get payment details (Adyen)","tags":["External: Payments"],"description":"Get full payment details including captures, refunds, and cancellation status. This endpoint is mock-only (not in real Adyen Checkout API) — useful for debugging.","parameters":[{"schema":{"type":"string"},"in":"path","name":"pspReference","required":true,"description":"PSP reference"}],"responses":{"200":{"description":"Default Response"}}}},"/external/klarna/payments/v1/sessions":{"post":{"summary":"Create Klarna payment session","tags":["External: Payments"],"description":"Create a new Klarna payment session. Returns a session_id and client_token for the Klarna widget. Sessions expire after 48 hours. Based on Klarna Payments API V1.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["purchase_country","purchase_currency","order_amount","order_lines"],"properties":{"purchase_country":{"type":"string","description":"ISO 3166-1 alpha-2 country code (e.g. SE, DE)"},"purchase_currency":{"type":"string","description":"ISO 4217 currency code"},"locale":{"type":"string","description":"Locale string (e.g. sv-SE). Auto-detected from country if omitted."},"order_amount":{"type":"number","description":"Total order amount in minor units (e.g. 10000 = 100.00 SEK)"},"order_lines":{"type":"array","items":{"type":"object","required":["name","quantity","unit_price","total_amount"],"properties":{"name":{"type":"string","description":"Product name"},"quantity":{"type":"number","description":"Quantity"},"unit_price":{"type":"number","description":"Unit price in minor units"},"total_amount":{"type":"number","description":"Total line amount in minor units"},"reference":{"type":"string","description":"SKU or product reference"}}}}}}}}},"responses":{"200":{"description":"Default Response"}}}},"/external/klarna/payments/v1/sessions/{sessionId}":{"get":{"summary":"Get Klarna session","tags":["External: Payments"],"description":"Get the current status and details of a Klarna payment session. Expired sessions (>48h) will show status \"expired\".","parameters":[{"schema":{"type":"string"},"in":"path","name":"sessionId","required":true,"description":"Klarna session ID (e.g. ks_...)"}],"responses":{"200":{"description":"Default Response"}}},"put":{"summary":"Update Klarna session","tags":["External: Payments"],"description":"Update an existing Klarna payment session with new amount or order lines. Cannot update expired sessions.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"order_amount":{"type":"number","description":"Updated order amount in minor units"},"order_lines":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"quantity":{"type":"number"},"unit_price":{"type":"number"},"total_amount":{"type":"number"},"reference":{"type":"string"}}}},"purchase_currency":{"type":"string","description":"Updated currency"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"sessionId","required":true,"description":"Klarna session ID"}],"responses":{"200":{"description":"Default Response"}}}},"/external/klarna/payments/v1/authorizations/{authorizationToken}/order":{"post":{"summary":"Create Klarna order from authorization","tags":["External: Payments"],"description":"Create a Klarna order from an authorized payment session. Authorization tokens are valid for 60 minutes. Returns order_id and fraud_status. Based on Klarna Payments API V1.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["purchase_country","purchase_currency","order_amount","order_lines"],"properties":{"purchase_country":{"type":"string"},"purchase_currency":{"type":"string"},"order_amount":{"type":"number"},"order_lines":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"quantity":{"type":"number"},"unit_price":{"type":"number"},"total_amount":{"type":"number"}}}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"authorizationToken","required":true,"description":"Authorization token (e.g. ka_...)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/klarna/payments/v1/orders":{"get":{"summary":"List all Klarna orders","tags":["External: Payments"],"description":"List all Klarna orders with optional filtering by status or purchase country. Returns seeded orders linked to Nordic/EU e-commerce sales orders from IMS.","parameters":[{"schema":{"type":"string"},"in":"query","name":"status","required":false,"description":"Filter by status (AUTHORIZED, CAPTURED, REFUNDED, etc.)"},{"schema":{"type":"string"},"in":"query","name":"purchase_country","required":false,"description":"Filter by purchase country code (e.g. SE, DE)"},{"schema":{"type":"string"},"in":"query","name":"limit","required":false,"description":"Max results (default 50, max 100)"},{"schema":{"type":"string"},"in":"query","name":"offset","required":false,"description":"Offset for pagination (default 0)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/klarna/payments/v1/orders/{orderId}":{"get":{"summary":"Get Klarna order","tags":["External: Payments"],"description":"Get full Klarna order details including status, captures, and refunds.","parameters":[{"schema":{"type":"string"},"in":"path","name":"orderId","required":true,"description":"Klarna order ID (e.g. KO-...)"}],"responses":{"200":{"description":"Default Response"}}}},"/external/klarna/payments/v1/orders/{orderId}/captures":{"post":{"summary":"Capture Klarna order","tags":["External: Payments"],"description":"Capture a Klarna order (full or partial). Only AUTHORIZED or PART_CAPTURED orders can be captured.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["captured_amount"],"properties":{"captured_amount":{"type":"number","description":"Amount to capture in minor units"},"description":{"type":"string","description":"Capture description"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orderId","required":true,"description":"Klarna order ID"}],"responses":{"200":{"description":"Default Response"}}}},"/external/klarna/payments/v1/orders/{orderId}/refunds":{"post":{"summary":"Refund Klarna order","tags":["External: Payments"],"description":"Refund a captured Klarna order (full or partial). Refund amount cannot exceed captured minus already-refunded.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["refunded_amount"],"properties":{"refunded_amount":{"type":"number","description":"Amount to refund in minor units"},"description":{"type":"string","description":"Refund reason/description"}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"orderId","required":true,"description":"Klarna order ID"}],"responses":{"200":{"description":"Default Response"}}}},"/brand/":{"get":{"summary":"Brand overview — company info, categories, key people, revenue","tags":["Brand Resources"],"description":"Returns comprehensive Acne Studios company information including founding history, leadership, revenue, product categories, seasonal structure, signature products, and notable collaborations. Structured for AI agent consumption.","responses":{"200":{"description":"Default Response"}}}},"/brand/style-guide":{"get":{"summary":"Full brand style guide — identity, colors, typography, photography, packaging","tags":["Brand Resources"],"description":"Complete Acne Studios brand guidelines including visual identity, tone of voice, color palette, typography specifications, photography style, packaging materials, store design principles, and sustainability commitments.","responses":{"200":{"description":"Default Response"}}}},"/brand/logos":{"get":{"summary":"Logo asset inventory with download URLs","tags":["Brand Resources"],"description":"Lists all available logo variants (wordmark, Face motif) with format, dimensions, and direct download URLs for SVG assets.","responses":{"200":{"description":"Default Response"}}}},"/brand/pricing":{"get":{"summary":"Pricing guide — price ranges, wholesale markup, markdown policy","tags":["Brand Resources"],"description":"Retail price ranges by category, wholesale multiplier, exchange rates, and markdown/sale timing rules.","responses":{"200":{"description":"Default Response"}}}},"/brand/stores":{"get":{"summary":"Global store directory — regions, flagships, department store presence, marketplaces","tags":["Brand Resources"],"description":"Complete directory of Acne Studios retail presence: owned stores by region, flagship locations, department store partners, and online marketplace presence.","responses":{"200":{"description":"Default Response"}}}},"/brand/assets/logo-black.svg":{"get":{"summary":"Download: Logo (black on transparent)","tags":["Brand Resources"],"description":"SVG wordmark logo, black text on transparent background.","responses":{"200":{"description":"Default Response"}}}},"/brand/assets/logo-white.svg":{"get":{"summary":"Download: Logo (white on black)","tags":["Brand Resources"],"description":"SVG wordmark logo, white text on black background.","responses":{"200":{"description":"Default Response"}}}},"/brand/assets/face-patch.svg":{"get":{"summary":"Download: Face motif SVG","tags":["Brand Resources"],"description":"The signature Face smiley used on the Face Collection.","responses":{"200":{"description":"Default Response"}}}},"/brand/assets/logo-wordmark-large.svg":{"get":{"summary":"Download: Large wordmark SVG","tags":["Brand Resources"],"description":"Large-format wordmark for hero sections and print.","responses":{"200":{"description":"Default Response"}}}},"/brand/assets/logo-black-transparent.svg":{"get":{"summary":"Download: Logo (black on transparent) — alias","tags":["Brand Resources"],"description":"Same as logo-black.svg.","responses":{"200":{"description":"Default Response"}}}},"/":{"get":{"responses":{"200":{"description":"Default Response"}}}},"/dashboard":{"get":{"responses":{"200":{"description":"Default Response"}}}},"/favicon.ico":{"get":{"responses":{"200":{"description":"Default Response"}}}},"/llms.txt":{"get":{"responses":{"200":{"description":"Default Response"}}}},"/ai-context.json":{"get":{"responses":{"200":{"description":"Default Response"}}}}},"servers":[{"url":"/"}],"tags":[{"name":"Auth","description":"Authentication & user profile"},{"name":"Products","description":"Product catalog & SKUs"},{"name":"Purchase Orders","description":"PO lifecycle management"},{"name":"Sales Orders","description":"SO lifecycle management"},{"name":"Matching","description":"SO↔PO matching engine"},{"name":"Inventory","description":"Stock levels, transfers, adjustments"},{"name":"AI Intelligence","description":"Forecasts, recommendations, anomalies"},{"name":"Reports","description":"Analytics & reporting"},{"name":"Stakeholders","description":"User & role management"},{"name":"Webhooks","description":"Inbound webhook receivers for external system events"},{"name":"Admin","description":"Server management, reset, latency, time-travel"},{"name":"External API Directory","description":"Machine-readable directory of all 11 external system mocks — start here for AI agent discovery"},{"name":"External: SFCC","description":"Salesforce Commerce Cloud mock"},{"name":"External: Teamwork","description":"Teamwork Commerce OMS mock"},{"name":"External: Blue Yonder","description":"Blue Yonder WMS mock"},{"name":"External: Nedap","description":"Nedap iD Cloud RFID mock"},{"name":"External: NuORDER","description":"NuORDER B2B wholesale mock"},{"name":"External: Centric","description":"Centric Software PLM mock"},{"name":"External: Medius","description":"Medius AP automation mock"},{"name":"External: Payments","description":"Adyen & Klarna payment mocks"},{"name":"External: Temera DPP","description":"Temera Digital Product Passport — EU ESPR compliance, NFC/QR, blockchain traceability"},{"name":"External: D365","description":"Microsoft Dynamics 365 Finance & Operations — OData v4 ERP mock"},{"name":"Brand Resources","description":"Acne Studios brand assets — logos, style guide, colors, typography, pricing, store directory"}]}