{"openapi":"3.0.3","info":{"title":"Production Core - Vehicle Assembly MES API","version":"1.0.0","description":"REST API for **Production Core**, an end-to-end Manufacturing Execution System for a\nvehicle assembly plant, built on Node-RED.\n\nThe simulated plant is **NorthStar Motors / Windsor Assembly Plant**\n(Windsor, Ontario, Canada) - 7 production lines and\n43 stations covering body shop, paint, door line,\nwheel & tire, sub-assembly, main assembly and end-of-line quality.\n\n### What this API is for\n\n| Area | Endpoints | What it does |\n| --- | --- | --- |\n| Plant model | `/plant`, `/lines`, `/stations` | ISA-95 hierarchy and live station state |\n| Scheduling | `/work-orders` | Create, release and track build orders |\n| Execution | `/units` | Move vehicles through the routing, enforce the sequence |\n| Feeder lines | `/sub-assemblies` | Serialised modules and buffer levels |\n| Quality | `/quality/*` | Inspection plans, defects, dispositions, gates |\n| Floor ops | `/andon`, `/downtime` | Line-stop calls and ISO 22400 downtime reasons |\n| Station control | `/stations/{id}/start` `/stop` `/maintenance` | Operator lockout and maintenance orders |\n| KPIs | `/kpi/*` | OEE, FPY, throughput and shift trend (ISO 22400-2) |\n| Traceability | `/trace/*` | As-built genealogy and supplier-lot recall analysis |\n| Streaming | `/events/stream` | Server-sent event feed of everything happening |\n\n### Authentication\n\nRead endpoints are open so this demo is browsable. Any request that changes plant\nstate needs an API key in the `x-api-key` header. On the public demo the key is\n`production-core-demo-key` - click **Authorize** above and paste it in.\n\n### Try the interesting one first\n\nRun `GET /trace/lots` to list supplier batches, then `POST /trace/recall` with one of\nthem. That is the query an MES exists to answer: which vehicles contain a suspect part,\nwhere are they now, and how much does containment cost.","contact":{"name":"Production Core","url":"https://github.com/"},"license":{"name":"MIT","url":"https://opensource.org/licenses/MIT"}},"servers":[{"url":"https://production-factory-core.vercel.app/api/v1","description":"Live deployment"}],"externalDocs":{"description":"Architecture, domain model and deployment notes","url":"/docs/ARCHITECTURE.md"},"tags":[{"name":"System","description":"Health, readiness and runtime diagnostics"},{"name":"Plant","description":"ISA-95 plant hierarchy and reference data"},{"name":"Work Orders","description":"Production scheduling"},{"name":"Units","description":"Vehicle execution and routing"},{"name":"Sub-Assemblies","description":"Serialised feeder-line modules"},{"name":"Quality","description":"Inspections, defects and quality gates"},{"name":"Station Control","description":"Operator start/stop with lockout, and maintenance orders"},{"name":"Andon","description":"Line-stop calls and escalation"},{"name":"Downtime","description":"Stoppage capture with ISO 22400 reason codes"},{"name":"KPI","description":"OEE and production performance"},{"name":"Traceability","description":"Genealogy and recall analysis"},{"name":"Events","description":"Event log and live stream"},{"name":"Simulator","description":"Drive the simulated plant"}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Required for all state-changing (POST/PATCH/DELETE) requests."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable identifier.","enum":["VALIDATION_FAILED","NOT_FOUND","INVALID_STATE_TRANSITION","CONFLICT","UNAUTHORIZED","QUALITY_HOLD","ROUTE_NOT_FOUND","MALFORMED_JSON","INTERNAL_ERROR"]},"message":{"type":"string"},"details":{"type":"object","additionalProperties":true}},"required":["code","message"]},"requestId":{"type":"string"}},"example":{"error":{"code":"QUALITY_HOLD","message":"Unit 2NSAURE1XTW001042 is held at BODY-50 by 1 open defect(s)","details":{"vin":"2NSAURE1XTW001042","station":"BODY-50"}}}},"Station":{"type":"object","properties":{"id":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]},"name":{"type":"string"},"lineId":{"type":"string","enum":["BODY","PAINT","DOOR","TIRE","SUBASM","MAINASM","QUALITY"]},"sequence":{"type":"integer"},"capability":{"type":"string","enum":["WELD","PAINT","ASSEMBLE","TORQUE","INSPECT","TEST","KIT"]},"cycleSeconds":{"type":"number","description":"Ideal cycle time (ISO 22400 ICT)."},"qualityGate":{"type":"boolean","description":"Blocks units carrying open defects."},"criticalToQuality":{"type":"boolean"},"producesSerial":{"type":"string","nullable":true},"consumesSerial":{"type":"array","items":{"type":"string"}}}},"StationState":{"type":"object","properties":{"stationId":{"type":"string"},"stationName":{"type":"string"},"lineId":{"type":"string"},"state":{"type":"string","enum":["RUNNING","IDLE","STARVED","BLOCKED","DOWN","STOPPED","CHANGEOVER","MAINTENANCE","OFFLINE"]},"previousState":{"type":"string","nullable":true},"since":{"type":"string","format":"date-time"},"currentVin":{"type":"string","nullable":true},"cycleCount":{"type":"integer"},"goodCount":{"type":"integer"},"lastCycleSeconds":{"type":"number","nullable":true},"idealCycleSeconds":{"type":"number"},"openDowntimeId":{"type":"string","nullable":true}}},"WorkOrder":{"type":"object","properties":{"id":{"type":"string","example":"WO-2026-0042"},"modelCode":{"type":"string","enum":["NS-AURORA-EV","NS-BOREALIS-HEV","NS-VOYAGEUR-ICE"]},"modelName":{"type":"string"},"colour":{"type":"string"},"quantity":{"type":"integer","minimum":1,"maximum":2000},"quantityStarted":{"type":"integer"},"quantityCompleted":{"type":"integer"},"quantityScrapped":{"type":"integer"},"priority":{"type":"string","enum":["LOW","NORMAL","HIGH","EXPEDITE"]},"status":{"type":"string","enum":["DRAFT","RELEASED","IN_PROGRESS","ON_HOLD","COMPLETED","CANCELLED"]},"customerRef":{"type":"string","nullable":true},"dueDate":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"}}},"WorkOrderCreate":{"type":"object","required":["modelCode","quantity"],"properties":{"id":{"type":"string","description":"Optional. Generated when omitted."},"modelCode":{"type":"string","enum":["NS-AURORA-EV","NS-BOREALIS-HEV","NS-VOYAGEUR-ICE"]},"quantity":{"type":"integer","minimum":1,"maximum":2000},"colour":{"type":"string","description":"Must be a colour offered for the model."},"priority":{"type":"string","enum":["LOW","NORMAL","HIGH","EXPEDITE"],"default":"NORMAL"},"dueDate":{"type":"string","format":"date-time"},"customerRef":{"type":"string"}},"example":{"modelCode":"NS-AURORA-EV","quantity":48,"colour":"Laurentian Blue","priority":"HIGH","customerRef":"ORD-884210"}},"Unit":{"type":"object","description":"One physical vehicle moving through the plant.","properties":{"vin":{"type":"string","description":"ISO 3779 VIN with a valid check digit.","example":"2NSAURE1XTW001042"},"workOrderId":{"type":"string"},"modelCode":{"type":"string","enum":["NS-AURORA-EV","NS-BOREALIS-HEV","NS-VOYAGEUR-ICE"]},"colour":{"type":"string"},"buildNumber":{"type":"integer","nullable":true},"status":{"type":"string","enum":["PLANNED","IN_PROCESS","HOLD","REWORK","COMPLETED","SCRAPPED"]},"currentStation":{"type":"string","nullable":true},"currentLine":{"type":"string","nullable":true},"progressPct":{"type":"number"},"openDefects":{"type":"integer"},"reworkCount":{"type":"integer"},"firstPass":{"type":"boolean","description":"Cleared every station without rework."}}},"SubAssembly":{"type":"object","properties":{"serial":{"type":"string","example":"PWT-26259-000412"},"classCode":{"type":"string","enum":["DRS","WHS","PWT","CKP","SET","CNF","CNR"]},"description":{"type":"string"},"buildMode":{"type":"string","enum":["BROADCAST","STOCK"]},"status":{"type":"string","enum":["BUILDING","AVAILABLE","ALLOCATED","CONSUMED","QUARANTINED","SCRAPPED"]},"builtAt":{"type":"string"},"installsAt":{"type":"string","nullable":true},"forVin":{"type":"string","nullable":true},"consumedByVin":{"type":"string","nullable":true},"components":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"Defect":{"type":"object","properties":{"id":{"type":"string","example":"DEF-000317"},"code":{"type":"string","enum":["WELD_MISSING","WELD_BURN_THROUGH","GAP_FLUSH_OOS","PANEL_DENT","DIM_OUT_OF_TOL","ORANGE_PEEL","RUN_SAG","DIRT_INCLUSION","FISH_EYE","COLOUR_MISMATCH","THIN_FILM","TORQUE_LOW","TORQUE_HIGH","MISSING_FASTENER","HARNESS_UNSEATED","CLIP_BROKEN","WRONG_PART","DTC_PRESENT","TPMS_NO_SIGNAL","LAMP_INOP","MODULE_NO_COMM","SCRATCH","RATTLE_BSR","WATER_LEAK","TRIM_GAP","ALIGNMENT_OOS","BRAKE_IMBALANCE","HOT_TEST_FAIL","BALANCE_OOS","DOOR_EFFORT_HIGH"]},"family":{"type":"string"},"severity":{"type":"string","enum":["CRITICAL","MAJOR","MINOR"]},"status":{"type":"string","enum":["OPEN","IN_REPAIR","VERIFIED","CLOSED"]},"vin":{"type":"string","nullable":true},"stationId":{"type":"string"},"lineId":{"type":"string","nullable":true},"disposition":{"type":"string","enum":["REWORK","REPAIR","SCRAP","USE_AS_IS","RETURN_TO_SUPPLIER"],"nullable":true},"suspectLotCode":{"type":"string","nullable":true}}},"Inspection":{"type":"object","properties":{"id":{"type":"string"},"planId":{"type":"string","enum":["IP-BIW-CMM","IP-PAINT-VISUAL","IP-DOOR-FUNC","IP-WHEEL-RUNOUT","IP-PT-HOTTEST","IP-EOL-ALIGN","IP-EOL-LAMP","IP-EOL-ROLL","IP-EOL-WATER","IP-EOL-DTC","IP-EOL-AUDIT"]},"stationId":{"type":"string"},"subject":{"type":"string","description":"VIN or sub-assembly serial."},"passed":{"type":"boolean"},"results":{"type":"array","items":{"type":"object","properties":{"characteristicId":{"type":"string"},"value":{"type":"number"},"lowerLimit":{"type":"number"},"upperLimit":{"type":"number"},"inSpec":{"type":"boolean"},"deviation":{"type":"number"}}}},"defectCodes":{"type":"array","items":{"type":"string"}}}},"InspectionCreate":{"type":"object","required":["measurements"],"properties":{"planId":{"type":"string","enum":["IP-BIW-CMM","IP-PAINT-VISUAL","IP-DOOR-FUNC","IP-WHEEL-RUNOUT","IP-PT-HOTTEST","IP-EOL-ALIGN","IP-EOL-LAMP","IP-EOL-ROLL","IP-EOL-WATER","IP-EOL-DTC","IP-EOL-AUDIT"]},"stationId":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"],"description":"Used to look up the plan when planId is omitted."},"vin":{"type":"string"},"serial":{"type":"string"},"inspector":{"type":"string"},"measurements":{"type":"object","additionalProperties":{"type":"number"},"description":"One value per characteristic in the plan. All are required."}},"example":{"stationId":"EOL-10","vin":"2NSAURE1XTW001042","inspector":"qa-201","measurements":{"TOE-FRONT":0.42,"CAMBER-FRONT":-0.5,"THRUST-ANGLE":0.02}}},"StationControl":{"type":"object","description":"Everything a control panel needs for one station. Returned by every control action.","properties":{"stationId":{"type":"string"},"state":{"type":"string","enum":["RUNNING","IDLE","STARVED","BLOCKED","DOWN","STOPPED","CHANGEOVER","MAINTENANCE","OFFLINE"]},"control":{"type":"object","properties":{"mode":{"type":"string","enum":["AUTO","STOPPED","MAINTENANCE"]},"since":{"type":"string","format":"date-time"},"by":{"type":"string"},"reason":{"type":"string","nullable":true},"reasonCode":{"type":"string","nullable":true},"maintenanceOrderId":{"type":"string","nullable":true}}},"locked":{"type":"boolean","description":"Automated state changes are refused while true."},"allowedActions":{"type":"array","items":{"type":"string","enum":["start","stop","maintenance","completeMaintenance"]}},"blockedActions":{"type":"object","additionalProperties":{"type":"string"},"description":"Why each unavailable action is unavailable, keyed by action."},"pm":{"type":"object","properties":{"intervalCycles":{"type":"integer"},"cyclesSinceMaintenance":{"type":"integer"},"usedPct":{"type":"number"},"remainingCycles":{"type":"integer"},"status":{"type":"string","enum":["OK","DUE_SOON","DUE","OVERDUE"]}}},"activeMaintenance":{"allOf":[{"$ref":"#/components/schemas/MaintenanceOrder"}],"nullable":true}}},"MaintenanceOrder":{"type":"object","properties":{"id":{"type":"string","example":"MWO-000042"},"stationId":{"type":"string"},"type":{"type":"string","enum":["PREVENTIVE","PREDICTIVE","CORRECTIVE"]},"planned":{"type":"boolean","description":"Planned work comes out of planned busy time rather than availability."},"status":{"type":"string","enum":["IN_PROGRESS","COMPLETED","CANCELLED"]},"technician":{"type":"string"},"plannedMinutes":{"type":"number"},"actualMinutes":{"type":"number","nullable":true},"overrunMinutes":{"type":"number","nullable":true},"checklist":{"type":"array","items":{"type":"object","properties":{"task":{"type":"string"},"done":{"type":"boolean"}}}},"checklistComplete":{"type":"boolean"},"findings":{"type":"string","nullable":true},"downtimeId":{"type":"string","nullable":true},"andonId":{"type":"string","nullable":true},"startedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true}}},"Andon":{"type":"object","properties":{"id":{"type":"string","example":"AND-000118"},"stationId":{"type":"string"},"lineId":{"type":"string"},"callType":{"type":"string","enum":["MATERIAL","QUALITY","MAINTENANCE","SAFETY","PROCESS","TOOLING"]},"label":{"type":"string"},"colour":{"type":"string","enum":["red","amber","blue"]},"stopsLine":{"type":"boolean"},"slaSeconds":{"type":"integer"},"status":{"type":"string","enum":["RAISED","ACKNOWLEDGED","ESCALATED","RESOLVED","CANCELLED"]},"escalationTier":{"type":"integer"},"responseSeconds":{"type":"integer","nullable":true},"slaMet":{"type":"boolean","nullable":true}}},"AndonCreate":{"type":"object","required":["stationId","callType"],"properties":{"stationId":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]},"callType":{"type":"string","enum":["MATERIAL","QUALITY","MAINTENANCE","SAFETY","PROCESS","TOOLING"]},"raisedBy":{"type":"string"},"vin":{"type":"string"},"note":{"type":"string"}},"example":{"stationId":"CHAS-10","callType":"MAINTENANCE","raisedBy":"op-4408","note":"Decking fixture will not clamp"}},"Downtime":{"type":"object","properties":{"id":{"type":"string"},"stationId":{"type":"string"},"lineId":{"type":"string"},"reasonCode":{"type":"string","enum":["EQUIP_FAILURE","ROBOT_FAULT","TOOL_BREAKAGE","CONVEYOR_JAM","MATERIAL_SHORTAGE","QUALITY_HOLD","ANDON_STOP","UPSTREAM_BLOCKED","DOWNSTREAM_STARVED","OPERATOR_ABSENT","POWER_LOSS","SLOW_CYCLE","OPERATOR_STOP","CHANGEOVER","PREVENTIVE_MAINT","SCHEDULED_BREAK","SHIFT_MEETING","NO_SCHEDULE","TRIAL_BUILD"]},"reasonLabel":{"type":"string"},"category":{"type":"string","enum":["PLANNED","UNPLANNED"]},"bigLoss":{"type":"string","nullable":true,"enum":["BREAKDOWN","SETUP_ADJUSTMENT","IDLING_MINOR_STOP","REDUCED_SPEED","PROCESS_DEFECT","REDUCED_YIELD",null]},"startedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time","nullable":true},"durationSeconds":{"type":"integer","nullable":true},"rootCause":{"type":"string","nullable":true}}},"Oee":{"type":"object","description":"ISO 22400-2 overall equipment effectiveness. All values are percentages.","properties":{"availability":{"type":"number","description":"Actual production time / planned busy time."},"performance":{"type":"number","description":"Ideal cycle x count / actual production time. Capped at 100."},"quality":{"type":"number","description":"First-pass good count / total count."},"oee":{"type":"number","description":"availability x performance x quality."},"teep":{"type":"number","description":"OEE measured against all 24 hours."},"rating":{"type":"string","enum":["WORLD_CLASS","GOOD","ACCEPTABLE","NEEDS_ATTENTION"]},"losses":{"type":"object","description":"Where the shift went, in seconds. Sums back to net planned time.","properties":{"availabilityLossSeconds":{"type":"integer"},"performanceLossSeconds":{"type":"integer"},"qualityLossSeconds":{"type":"integer"},"valueAddingSeconds":{"type":"integer"}}},"warnings":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"RecallQuery":{"type":"object","description":"Supply exactly one of lotCode, serial or partNumber.","properties":{"lotCode":{"type":"string","description":"Supplier batch code.","example":"BREMBO-PN-BRAKE-FRONT-2638B"},"serial":{"type":"string","description":"Serialised sub-assembly."},"partNumber":{"type":"string","description":"Every vehicle containing this part."},"reason":{"type":"string","description":"Recorded on the audit event."}},"example":{"lotCode":"BREMBO-PN-BRAKE-FRONT-2638B","reason":"Supplier quality alert 2026-09-16"}},"RecallReport":{"type":"object","properties":{"affectedCount":{"type":"integer"},"byContainment":{"type":"object","description":"Where the affected vehicles are now. IN_PLANT is the cheap column.","properties":{"IN_PLANT":{"type":"integer"},"FINISHED_GOODS":{"type":"integer"},"SHIPPED":{"type":"integer"},"SCRAPPED":{"type":"integer"}}},"supplier":{"type":"string","nullable":true},"safetyCritical":{"type":"boolean"},"containableNow":{"type":"integer"},"estimatedRecallCostCad":{"type":"number"},"recommendation":{"type":"object","properties":{"action":{"type":"string","enum":["NO_ACTION","CONTAIN_IN_PLANT","FIELD_CAMPAIGN","SAFETY_RECALL"]},"rationale":{"type":"string"}}},"affected":{"type":"array","items":{"type":"object","additionalProperties":true}}}},"Genealogy":{"type":"object","description":"As-built record. Append-only, and sealed when the vehicle is released.","properties":{"vin":{"type":"string"},"components":{"type":"array","description":"Tree of parts and sub-assemblies, each with its supplier lot.","items":{"type":"object","additionalProperties":true}},"lotIndex":{"type":"array","items":{"type":"string"}},"serialIndex":{"type":"array","items":{"type":"string"}},"sealedAt":{"type":"string","format":"date-time","nullable":true},"stats":{"type":"object","additionalProperties":true}}},"Event":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","example":"unit.moved"},"timestamp":{"type":"string","format":"date-time"},"severity":{"type":"string","enum":["info","success","warning","error"]},"stationId":{"type":"string","nullable":true},"lineId":{"type":"string","nullable":true},"vin":{"type":"string","nullable":true},"payload":{"type":"object","additionalProperties":true}}},"Collection":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","additionalProperties":true}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"}}}}},"paths":{"/health":{"get":{"tags":["System"],"summary":"Service health and runtime diagnostics","description":"Includes store collection sizes, simulator state and MQTT broker state. Useful as a PaaS health check.","responses":{"200":{"description":"Service is healthy.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/live":{"get":{"tags":["System"],"summary":"Liveness probe","responses":{"200":{"description":"Process is alive.","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/ready":{"get":{"tags":["System"],"summary":"Readiness probe","description":"Returns 503 until the plant model and station states are loaded.","responses":{"200":{"description":"Ready to serve traffic.","content":{"application/json":{"schema":{"type":"object"}}}},"503":{"description":"Still starting up.","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/plant":{"get":{"tags":["Plant"],"summary":"ISA-95 plant hierarchy","description":"Enterprise > Site > Area > Line > Station, with takt times, capacity and the design bottleneck of each line.","responses":{"200":{"description":"The full plant model.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/lines":{"get":{"tags":["Plant"],"summary":"List production lines","responses":{"200":{"description":"All lines.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}}},"/lines/{lineId}":{"get":{"tags":["Plant"],"summary":"Get one line with its stations","parameters":[{"name":"lineId","in":"path","description":"Line identifier.","required":true,"schema":{"type":"string","enum":["BODY","PAINT","DOOR","TIRE","SUBASM","MAINASM","QUALITY"]}}],"responses":{"200":{"description":"The line.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/lines/{lineId}/oee":{"get":{"tags":["KPI"],"summary":"OEE for a line","description":"Rolled up from its stations: availability and performance come from the constraint station, quality compounds along the route.","parameters":[{"name":"lineId","in":"path","description":"Line identifier.","required":true,"schema":{"type":"string","enum":["BODY","PAINT","DOOR","TIRE","SUBASM","MAINASM","QUALITY"]}},{"name":"since","in":"query","description":"Window start (ISO-8601). Defaults to the current shift.","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"until","in":"query","description":"Window end (ISO-8601).","required":false,"schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Line OEE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Oee"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stations":{"get":{"tags":["Plant"],"summary":"List stations with live state","parameters":[{"name":"lineId","in":"query","description":"Filter to one line.","required":false,"schema":{"type":"string","enum":["BODY","PAINT","DOOR","TIRE","SUBASM","MAINASM","QUALITY"]}}],"responses":{"200":{"description":"Stations and their current state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}}},"/stations/{stationId}":{"get":{"tags":["Plant"],"summary":"Get a station","description":"Includes the parts it back-flushes and its inspection plan, if it is a gate.","parameters":[{"name":"stationId","in":"path","description":"Station identifier.","required":true,"schema":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]}}],"responses":{"200":{"description":"The station.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Station"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stations/{stationId}/state":{"post":{"tags":["Plant"],"summary":"Change a station state","security":[{"ApiKeyAuth":[]}],"description":"Moving into DOWN, STARVED, BLOCKED, MAINTENANCE or CHANGEOVER opens a downtime record automatically; moving out closes it.","parameters":[{"name":"stationId","in":"path","description":"Station identifier.","required":true,"schema":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["state"],"properties":{"state":{"type":"string","enum":["RUNNING","IDLE","STARVED","BLOCKED","DOWN","STOPPED","CHANGEOVER","MAINTENANCE","OFFLINE"]},"reasonCode":{"type":"string","enum":["EQUIP_FAILURE","ROBOT_FAULT","TOOL_BREAKAGE","CONVEYOR_JAM","MATERIAL_SHORTAGE","QUALITY_HOLD","ANDON_STOP","UPSTREAM_BLOCKED","DOWNSTREAM_STARVED","OPERATOR_ABSENT","POWER_LOSS","SLOW_CYCLE","OPERATOR_STOP","CHANGEOVER","PREVENTIVE_MAINT","SCHEDULED_BREAK","SHIFT_MEETING","NO_SCHEDULE","TRIAL_BUILD"]},"reason":{"type":"string"},"operator":{"type":"string"}}},"example":{"state":"DOWN","reasonCode":"ROBOT_FAULT","reason":"Servo drive over-temperature","operator":"op-4408"}}}},"responses":{"200":{"description":"Updated station state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StationState"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stations/{stationId}/control":{"get":{"tags":["Station Control"],"summary":"Control view for a station","description":"State, control mode, the operator actions currently legal and why the others are not, PM status and any open maintenance order. The HMI renders its buttons from `allowedActions`.","parameters":[{"name":"stationId","in":"path","description":"Station identifier.","required":true,"schema":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]}}],"responses":{"200":{"description":"Control view.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StationControl"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stations/{stationId}/stop":{"post":{"tags":["Station Control"],"summary":"Stop a station (operator lockout)","security":[{"ApiKeyAuth":[]}],"description":"The station holds whatever vehicle it has and **stays stopped**: automated state changes - the simulator, a flow, a PLC over MQTT - are refused until someone starts it. Vehicles cannot be moved into it without `force`.\n\nThe reason code decides the OEE consequence: `SCHEDULED_BREAK` or `SHIFT_MEETING` are planned and come out of planned busy time; the default `OPERATOR_STOP` is an availability loss.","parameters":[{"name":"stationId","in":"path","description":"Station identifier.","required":true,"schema":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"operator":{"type":"string"},"reasonCode":{"type":"string","enum":["EQUIP_FAILURE","ROBOT_FAULT","TOOL_BREAKAGE","CONVEYOR_JAM","MATERIAL_SHORTAGE","QUALITY_HOLD","ANDON_STOP","UPSTREAM_BLOCKED","DOWNSTREAM_STARVED","OPERATOR_ABSENT","POWER_LOSS","SLOW_CYCLE","OPERATOR_STOP","CHANGEOVER","PREVENTIVE_MAINT","SCHEDULED_BREAK","SHIFT_MEETING","NO_SCHEDULE","TRIAL_BUILD"],"default":"OPERATOR_STOP"},"reason":{"type":"string"}}},"example":{"operator":"op-2271","reasonCode":"SCHEDULED_BREAK","reason":"Lunch relief"}}}},"responses":{"200":{"description":"Stopped.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StationControl"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stations/{stationId}/start":{"post":{"tags":["Station Control"],"summary":"Start a station","security":[{"ApiKeyAuth":[]}],"description":"From an operator stop, or from a fault once nothing is holding it down. A station down on an open line-stopping andon returns 409 - resolve the call, which is where the response time is recorded. A station under maintenance returns 409 - complete the order.","parameters":[{"name":"stationId","in":"path","description":"Station identifier.","required":true,"schema":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"operator":{"type":"string"},"note":{"type":"string"}}},"example":{"operator":"op-2271"}}}},"responses":{"200":{"description":"Back in service.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StationControl"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stations/{stationId}/maintenance":{"get":{"tags":["Station Control"],"summary":"Maintenance status and history for a station","parameters":[{"name":"stationId","in":"path","description":"Station identifier.","required":true,"schema":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]}}],"responses":{"200":{"description":"PM status, active order, checklist and history.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["Station Control"],"summary":"Start maintenance","security":[{"ApiKeyAuth":[]}],"description":"Opens a maintenance order and locks the station. Downtime is booked by type:\n\n| Type | Downtime | OEE |\n| --- | --- | --- |\n| `PREVENTIVE`, `PREDICTIVE` | `PREVENTIVE_MAINT`, planned | out of planned busy time |\n| `CORRECTIVE` | keeps the failure downtime if the station is down, else `EQUIP_FAILURE` | availability loss, counts for MTBF/MTTR |\n\nType defaults to `CORRECTIVE` for a station that is down and `PREVENTIVE` otherwise.","parameters":[{"name":"stationId","in":"path","description":"Station identifier.","required":true,"schema":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["PREVENTIVE","PREDICTIVE","CORRECTIVE"]},"technician":{"type":"string"},"plannedMinutes":{"type":"number","minimum":1,"maximum":480},"note":{"type":"string"}}},"example":{"type":"PREVENTIVE","technician":"maint-771","plannedMinutes":20,"note":"Scheduled PM"}}}},"responses":{"201":{"description":"Maintenance started.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StationControl"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stations/{stationId}/maintenance/complete":{"post":{"tags":["Station Control"],"summary":"Complete maintenance and return to service","security":[{"ApiKeyAuth":[]}],"description":"Signs the order off, closes its downtime, resets the PM counter and - if the work answered an andon call - resolves that call too. `checklist` lists the tasks done; anything omitted is recorded as not done, which is how an audit finds a skipped step.","parameters":[{"name":"stationId","in":"path","description":"Station identifier.","required":true,"schema":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"technician":{"type":"string"},"findings":{"type":"string"},"partsReplaced":{"type":"array","items":{"type":"string"}},"checklist":{"type":"array","items":{"type":"string"}}}},"example":{"technician":"maint-771","findings":"Bell cup worn; replaced","partsReplaced":["PN-BELL-CUP"]}}}},"responses":{"200":{"description":"Completed; includes `completedOrder`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StationControl"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/stations/{stationId}/oee":{"get":{"tags":["KPI"],"summary":"OEE for a station","parameters":[{"name":"stationId","in":"path","description":"Station identifier.","required":true,"schema":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]}},{"name":"since","in":"query","description":"Window start. Defaults to the current shift.","required":false,"schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Station OEE with the loss waterfall.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Oee"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/models":{"get":{"tags":["Plant"],"summary":"Vehicle models this plant is tooled for","responses":{"200":{"description":"Models.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}}},"/parts":{"get":{"tags":["Plant"],"summary":"Part master","parameters":[{"name":"supplier","in":"query","description":"Filter by supplier code.","required":false,"schema":{"type":"string"}},{"name":"lotControlled","in":"query","description":"Only lot-controlled parts.","required":false,"schema":{"type":"boolean"}},{"name":"safetyCritical","in":"query","description":"Only safety-critical parts.","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Parts.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}}},"/boms/{modelCode}":{"get":{"tags":["Plant"],"summary":"Multi-level bill of materials for a model","parameters":[{"name":"modelCode","in":"path","description":"Model code.","required":true,"schema":{"type":"string","enum":["NS-AURORA-EV","NS-BOREALIS-HEV","NS-VOYAGEUR-ICE"]}}],"responses":{"200":{"description":"The BOM, derived from the routing.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/shifts":{"get":{"tags":["Plant"],"summary":"Shift calendar and the current shift window","responses":{"200":{"description":"Shifts.","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/reference/defect-codes":{"get":{"tags":["Quality"],"summary":"Defect code catalogue","parameters":[{"name":"family","in":"query","description":"Filter by family.","required":false,"schema":{"type":"string","enum":["BODY","PAINT","ASSEMBLY","ELECTRICAL","TRIM","FUNCTIONAL"]}}],"responses":{"200":{"description":"Defect codes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}}},"/reference/downtime-reasons":{"get":{"tags":["Downtime"],"summary":"Downtime reason codes with Six Big Losses mapping","parameters":[{"name":"category","in":"query","description":"Planned or unplanned.","required":false,"schema":{"type":"string","enum":["PLANNED","UNPLANNED"]}}],"responses":{"200":{"description":"Reason codes.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}}},"/reference/andon-types":{"get":{"tags":["Andon"],"summary":"Andon call types, SLAs and escalation tiers","responses":{"200":{"description":"Call types.","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/reference/inspection-plans":{"get":{"tags":["Quality"],"summary":"Inspection plans and their characteristics","responses":{"200":{"description":"Plans.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}}},"/work-orders":{"get":{"tags":["Work Orders"],"summary":"List work orders","parameters":[{"name":"status","in":"query","description":"Filter by status.","required":false,"schema":{"type":"string","enum":["DRAFT","RELEASED","IN_PROGRESS","ON_HOLD","COMPLETED","CANCELLED"]}},{"name":"modelCode","in":"query","description":"Filter by model.","required":false,"schema":{"type":"string","enum":["NS-AURORA-EV","NS-BOREALIS-HEV","NS-VOYAGEUR-ICE"]}},{"name":"limit","in":"query","description":"Maximum items to return (1-500).","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":50}},{"name":"offset","in":"query","description":"Items to skip, for paging.","required":false,"schema":{"type":"integer","minimum":0,"default":0}},{"name":"sort","in":"query","description":"Field to sort by.","required":false,"schema":{"type":"string"}},{"name":"order","in":"query","description":"Sort direction.","required":false,"schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"Work orders.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}},"post":{"tags":["Work Orders"],"summary":"Create a work order","security":[{"ApiKeyAuth":[]}],"description":"Created in DRAFT. Release it to mint vehicles and VINs.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkOrderCreate"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkOrder"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/work-orders/{id}":{"get":{"tags":["Work Orders"],"summary":"Get a work order with progress and its units","parameters":[{"name":"id","in":"path","description":"Work order id.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The work order.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkOrder"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/work-orders/{id}/release":{"post":{"tags":["Work Orders"],"summary":"Release to the floor","security":[{"ApiKeyAuth":[]}],"description":"Creates one vehicle per planned unit, each with a check-digit-valid VIN and an open genealogy record.","parameters":[{"name":"id","in":"path","description":"Work order id.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"createUnits":{"type":"integer","description":"Create fewer units than the order quantity."}}},"example":{"createUnits":10}}}},"responses":{"200":{"description":"Released, with the units created.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/work-orders/{id}/transition":{"post":{"tags":["Work Orders"],"summary":"Change work order status","security":[{"ApiKeyAuth":[]}],"parameters":[{"name":"id","in":"path","description":"Work order id.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["status"],"properties":{"status":{"type":"string","enum":["DRAFT","RELEASED","IN_PROGRESS","ON_HOLD","COMPLETED","CANCELLED"]},"reason":{"type":"string"}}},"example":{"status":"ON_HOLD","reason":"Awaiting seat delivery"}}}},"responses":{"200":{"description":"Updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkOrder"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/units":{"get":{"tags":["Units"],"summary":"List vehicles","parameters":[{"name":"status","in":"query","description":"Filter by status.","required":false,"schema":{"type":"string","enum":["PLANNED","IN_PROCESS","HOLD","REWORK","COMPLETED","SCRAPPED"]}},{"name":"lineId","in":"query","description":"Vehicles on this line.","required":false,"schema":{"type":"string","enum":["BODY","PAINT","DOOR","TIRE","SUBASM","MAINASM","QUALITY"]}},{"name":"stationId","in":"query","description":"Vehicles at this station.","required":false,"schema":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]}},{"name":"workOrderId","in":"query","description":"Vehicles from this work order.","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Maximum items to return (1-500).","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":50}},{"name":"offset","in":"query","description":"Items to skip, for paging.","required":false,"schema":{"type":"integer","minimum":0,"default":0}},{"name":"sort","in":"query","description":"Field to sort by.","required":false,"schema":{"type":"string"}},{"name":"order","in":"query","description":"Sort direction.","required":false,"schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"Vehicles.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}}},"/units/wip":{"get":{"tags":["Units"],"summary":"Vehicles currently on the floor","responses":{"200":{"description":"Work in progress.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}}},"/units/{vin}":{"get":{"tags":["Units"],"summary":"Get a vehicle","parameters":[{"name":"vin","in":"path","description":"Vehicle identification number.","required":true,"schema":{"type":"string"},"example":"2NSAURE1XTW001042"}],"responses":{"200":{"description":"The vehicle.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unit"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/units/{vin}/history":{"get":{"tags":["Units"],"summary":"Station-by-station build history","description":"Every visit with dwell time, cycle time and variance against the ideal, plus the remaining route.","parameters":[{"name":"vin","in":"path","description":"VIN.","required":true,"schema":{"type":"string"},"example":"2NSAURE1XTW001042"}],"responses":{"200":{"description":"Build history.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/units/{vin}/genealogy":{"get":{"tags":["Traceability"],"summary":"As-built genealogy for a vehicle","description":"The full component tree: parts with supplier lot codes, serialised sub-assemblies, and the parts inside those.","parameters":[{"name":"vin","in":"path","description":"VIN.","required":true,"schema":{"type":"string"},"example":"2NSAURE1XTW001042"}],"responses":{"200":{"description":"Genealogy.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Genealogy"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/units/{vin}/move":{"post":{"tags":["Units"],"summary":"Move a vehicle to a station","security":[{"ApiKeyAuth":[]}],"description":"Enforces the routing: a vehicle cannot skip stations unless `force` is set, which is recorded as an override.\n\nMoving off a quality-gate station fails with 409 QUALITY_HOLD while the vehicle carries an open CRITICAL or undispositioned MAJOR defect.\n\nAlso back-flushes the parts consumed at the target station and installs any sub-assembly it is due to fit.","parameters":[{"name":"vin","in":"path","description":"VIN.","required":true,"schema":{"type":"string"},"example":"2NSAURE1XTW001042"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["stationId"],"properties":{"stationId":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]},"operator":{"type":"string"},"force":{"type":"boolean","default":false},"result":{"type":"string","enum":["PASS","FAIL","REWORKED","SKIPPED"]}}},"example":{"stationId":"CHAS-10","operator":"op-2271"}}}},"responses":{"200":{"description":"Moved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unit"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/units/{vin}/advance":{"post":{"tags":["Units"],"summary":"Advance to the next station on the route","security":[{"ApiKeyAuth":[]}],"description":"Completes the vehicle when it is already at the end of the line.","parameters":[{"name":"vin","in":"path","description":"VIN.","required":true,"schema":{"type":"string"},"example":"2NSAURE1XTW001042"}],"responses":{"200":{"description":"Advanced.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unit"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/units/{vin}/hold":{"post":{"tags":["Units"],"summary":"Put a vehicle on hold","security":[{"ApiKeyAuth":[]}],"parameters":[{"name":"vin","in":"path","description":"VIN.","required":true,"schema":{"type":"string"},"example":"2NSAURE1XTW001042"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"},"operator":{"type":"string"}}},"example":{"reason":"Suspect brake lot pending disposition","operator":"qa-201"}}}},"responses":{"200":{"description":"Held.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unit"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/units/{vin}/rework":{"post":{"tags":["Units"],"summary":"Send a vehicle to rework","security":[{"ApiKeyAuth":[]}],"parameters":[{"name":"vin","in":"path","description":"VIN.","required":true,"schema":{"type":"string"},"example":"2NSAURE1XTW001042"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string"},"operator":{"type":"string"}}}}}},"responses":{"200":{"description":"Sent to rework.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unit"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/units/{vin}/release":{"post":{"tags":["Units"],"summary":"Return a held or reworked vehicle to the line","security":[{"ApiKeyAuth":[]}],"parameters":[{"name":"vin","in":"path","description":"VIN.","required":true,"schema":{"type":"string"},"example":"2NSAURE1XTW001042"}],"responses":{"200":{"description":"Released back to the line.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unit"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/units/{vin}/complete":{"post":{"tags":["Units"],"summary":"Release the vehicle to the yard","security":[{"ApiKeyAuth":[]}],"description":"Only legal from the end-of-line release station with no open defects. Seals the genealogy record and increments the work order.","parameters":[{"name":"vin","in":"path","description":"VIN.","required":true,"schema":{"type":"string"},"example":"2NSAURE1XTW001042"}],"responses":{"200":{"description":"Vehicle released.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unit"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/units/{vin}/scrap":{"post":{"tags":["Units"],"summary":"Scrap a vehicle","security":[{"ApiKeyAuth":[]}],"description":"Terminal and irreversible, as in a real plant.","parameters":[{"name":"vin","in":"path","description":"VIN.","required":true,"schema":{"type":"string"},"example":"2NSAURE1XTW001042"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["reason"],"properties":{"reason":{"type":"string"},"operator":{"type":"string"}}},"example":{"reason":"Unrecoverable dimensional defect at BODY-50","operator":"qa-203"}}}},"responses":{"200":{"description":"Scrapped.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Unit"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/sub-assemblies":{"get":{"tags":["Sub-Assemblies"],"summary":"List serialised sub-assemblies","parameters":[{"name":"classCode","in":"query","description":"Component class.","required":false,"schema":{"type":"string","enum":["DRS","WHS","PWT","CKP","SET","CNF","CNR"]}},{"name":"status","in":"query","description":"Filter by status.","required":false,"schema":{"type":"string","enum":["BUILDING","AVAILABLE","ALLOCATED","CONSUMED","QUARANTINED","SCRAPPED"]}},{"name":"consumedByVin","in":"query","description":"Serials fitted to this VIN.","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Maximum items to return (1-500).","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":50}},{"name":"offset","in":"query","description":"Items to skip, for paging.","required":false,"schema":{"type":"integer","minimum":0,"default":0}},{"name":"sort","in":"query","description":"Field to sort by.","required":false,"schema":{"type":"string"}},{"name":"order","in":"query","description":"Sort direction.","required":false,"schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"Sub-assemblies.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}},"post":{"tags":["Sub-Assemblies"],"summary":"Build a sub-assembly","security":[{"ApiKeyAuth":[]}],"description":"Back-flushes the cell's parts, records its functional test, and places it in the buffer. Door sets are broadcast-built and require forVin.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["classCode"],"properties":{"classCode":{"type":"string","enum":["DRS","WHS","PWT","CKP","SET","CNF","CNR"]},"forVin":{"type":"string"},"passed":{"type":"boolean","default":true}}},"example":{"classCode":"PWT"}}}},"responses":{"201":{"description":"Built.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubAssembly"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/sub-assemblies/buffers":{"get":{"tags":["Sub-Assemblies"],"summary":"Feeder buffer levels","description":"How many of each class are available, and which are close to starving final assembly.","responses":{"200":{"description":"Buffer levels.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}}},"/sub-assemblies/{serial}":{"get":{"tags":["Sub-Assemblies"],"summary":"Get a sub-assembly","parameters":[{"name":"serial","in":"path","description":"Serial number.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The sub-assembly.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubAssembly"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quality/summary":{"get":{"tags":["Quality"],"summary":"Quality summary with Pareto, FPY and DPMO","parameters":[{"name":"since","in":"query","description":"Window start.","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"lineId","in":"query","description":"Filter to a line.","required":false,"schema":{"type":"string","enum":["BODY","PAINT","DOOR","TIRE","SUBASM","MAINASM","QUALITY"]}}],"responses":{"200":{"description":"Quality summary.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/quality/inspections":{"get":{"tags":["Quality"],"summary":"List inspections","parameters":[{"name":"stationId","in":"query","description":"Filter by station.","required":false,"schema":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]}},{"name":"passed","in":"query","description":"Only passed or only failed.","required":false,"schema":{"type":"boolean"}},{"name":"limit","in":"query","description":"Maximum items to return (1-500).","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":50}},{"name":"offset","in":"query","description":"Items to skip, for paging.","required":false,"schema":{"type":"integer","minimum":0,"default":0}},{"name":"sort","in":"query","description":"Field to sort by.","required":false,"schema":{"type":"string"}},{"name":"order","in":"query","description":"Sort direction.","required":false,"schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"Inspections.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}},"post":{"tags":["Quality"],"summary":"Record an inspection","security":[{"ApiKeyAuth":[]}],"description":"Evaluates every characteristic against its spec window and raises a defect for each one that is out of tolerance.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InspectionCreate"}}}},"responses":{"201":{"description":"Inspection recorded, with any defects raised.","content":{"application/json":{"schema":{"type":"object","properties":{"inspection":{"$ref":"#/components/schemas/Inspection"},"defects":{"type":"array","items":{"$ref":"#/components/schemas/Defect"}}}}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quality/defects":{"get":{"tags":["Quality"],"summary":"List defects","parameters":[{"name":"severity","in":"query","description":"Filter by severity.","required":false,"schema":{"type":"string","enum":["CRITICAL","MAJOR","MINOR"]}},{"name":"status","in":"query","description":"Filter by status.","required":false,"schema":{"type":"string","enum":["OPEN","IN_REPAIR","VERIFIED","CLOSED"]}},{"name":"open","in":"query","description":"Only open (true) or only closed (false).","required":false,"schema":{"type":"boolean"}},{"name":"vin","in":"query","description":"Defects on one vehicle.","required":false,"schema":{"type":"string"}},{"name":"stationId","in":"query","description":"Defects found at one station.","required":false,"schema":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]}},{"name":"limit","in":"query","description":"Maximum items to return (1-500).","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":50}},{"name":"offset","in":"query","description":"Items to skip, for paging.","required":false,"schema":{"type":"integer","minimum":0,"default":0}},{"name":"sort","in":"query","description":"Field to sort by.","required":false,"schema":{"type":"string"}},{"name":"order","in":"query","description":"Sort direction.","required":false,"schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"Defects.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}},"post":{"tags":["Quality"],"summary":"Raise a defect","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["code","stationId"],"properties":{"code":{"type":"string","enum":["WELD_MISSING","WELD_BURN_THROUGH","GAP_FLUSH_OOS","PANEL_DENT","DIM_OUT_OF_TOL","ORANGE_PEEL","RUN_SAG","DIRT_INCLUSION","FISH_EYE","COLOUR_MISMATCH","THIN_FILM","TORQUE_LOW","TORQUE_HIGH","MISSING_FASTENER","HARNESS_UNSEATED","CLIP_BROKEN","WRONG_PART","DTC_PRESENT","TPMS_NO_SIGNAL","LAMP_INOP","MODULE_NO_COMM","SCRATCH","RATTLE_BSR","WATER_LEAK","TRIM_GAP","ALIGNMENT_OOS","BRAKE_IMBALANCE","HOT_TEST_FAIL","BALANCE_OOS","DOOR_EFFORT_HIGH"]},"vin":{"type":"string"},"serial":{"type":"string"},"stationId":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]},"severity":{"type":"string","enum":["CRITICAL","MAJOR","MINOR"]},"detectedBy":{"type":"string"}}},"example":{"code":"TORQUE_LOW","vin":"2NSAURE1XTW001042","stationId":"CHAS-10","detectedBy":"qa-202"}}}},"responses":{"201":{"description":"Defect raised.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Defect"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quality/defects/{id}":{"get":{"tags":["Quality"],"summary":"Get a defect","parameters":[{"name":"id","in":"path","description":"Defect id.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The defect.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Defect"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quality/defects/{id}/disposition":{"post":{"tags":["Quality"],"summary":"Disposition a defect","security":[{"ApiKeyAuth":[]}],"description":"A CRITICAL defect can never be dispositioned USE_AS_IS. Choosing SCRAP also scraps the vehicle.","parameters":[{"name":"id","in":"path","description":"Defect id.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["disposition"],"properties":{"disposition":{"type":"string","enum":["REWORK","REPAIR","SCRAP","USE_AS_IS","RETURN_TO_SUPPLIER"]},"operator":{"type":"string"},"note":{"type":"string"},"repairMinutes":{"type":"number"}}},"example":{"disposition":"REWORK","operator":"tech-9","repairMinutes":12}}}},"responses":{"200":{"description":"Dispositioned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Defect"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quality/defects/{id}/close":{"post":{"tags":["Quality"],"summary":"Close a defect after repair verification","security":[{"ApiKeyAuth":[]}],"parameters":[{"name":"id","in":"path","description":"Defect id.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Closed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Defect"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quality/gate/{vin}/{stationId}":{"get":{"tags":["Quality"],"summary":"Evaluate a quality gate without moving anything","description":"Pure query. Flows call this before advancing a vehicle so the decision and the movement stay separable.","parameters":[{"name":"vin","in":"path","description":"VIN.","required":true,"schema":{"type":"string"},"example":"2NSAURE1XTW001042"},{"name":"stationId","in":"path","description":"Gate station.","required":true,"schema":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]}}],"responses":{"200":{"description":"Gate evaluation with a recommendation.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/maintenance":{"get":{"tags":["Station Control"],"summary":"List maintenance orders","parameters":[{"name":"status","in":"query","description":"Filter by status.","required":false,"schema":{"type":"string","enum":["IN_PROGRESS","COMPLETED","CANCELLED"]}},{"name":"type","in":"query","description":"Filter by type.","required":false,"schema":{"type":"string","enum":["PREVENTIVE","PREDICTIVE","CORRECTIVE"]}},{"name":"stationId","in":"query","description":"Filter by station.","required":false,"schema":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]}},{"name":"limit","in":"query","description":"Maximum items to return (1-500).","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":50}},{"name":"offset","in":"query","description":"Items to skip, for paging.","required":false,"schema":{"type":"integer","minimum":0,"default":0}},{"name":"sort","in":"query","description":"Field to sort by.","required":false,"schema":{"type":"string"}},{"name":"order","in":"query","description":"Sort direction.","required":false,"schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"Maintenance orders, newest first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}}},"/maintenance/due":{"get":{"tags":["Station Control"],"summary":"Preventive-maintenance status for every station","description":"Cycles run since the last service against an interval derived from the station MTBF. Most overdue first. Overdue stations fail more often in the simulator - skipping PM is not free.","parameters":[{"name":"lineId","in":"query","description":"Filter to a line.","required":false,"schema":{"type":"string","enum":["BODY","PAINT","DOOR","TIRE","SUBASM","MAINASM","QUALITY"]}},{"name":"dueOnly","in":"query","description":"Only stations DUE_SOON or worse.","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"PM status per station.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}}},"/maintenance/{id}":{"get":{"tags":["Station Control"],"summary":"Get a maintenance order","parameters":[{"name":"id","in":"path","description":"Maintenance order id.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The order.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MaintenanceOrder"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/reference/state-machines":{"get":{"tags":["Plant"],"summary":"Every entity lifecycle, generated from the enforced transition tables","description":"Work order, vehicle, sub-assembly, defect, andon, station control mode and maintenance order. Built from the same tables the domain enforces, so these cannot drift from the rules. The documentation draws its state diagrams from this.","responses":{"200":{"description":"State machines keyed by entity.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/reference/maintenance-types":{"get":{"tags":["Station Control"],"summary":"Maintenance types, control modes and operator actions","responses":{"200":{"description":"Reference data.","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/andon":{"get":{"tags":["Andon"],"summary":"List andon calls","parameters":[{"name":"open","in":"query","description":"Only open calls.","required":false,"schema":{"type":"boolean"}},{"name":"lineId","in":"query","description":"Filter by line.","required":false,"schema":{"type":"string","enum":["BODY","PAINT","DOOR","TIRE","SUBASM","MAINASM","QUALITY"]}},{"name":"limit","in":"query","description":"Maximum items to return (1-500).","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":50}},{"name":"offset","in":"query","description":"Items to skip, for paging.","required":false,"schema":{"type":"integer","minimum":0,"default":0}},{"name":"sort","in":"query","description":"Field to sort by.","required":false,"schema":{"type":"string"}},{"name":"order","in":"query","description":"Sort direction.","required":false,"schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"Andon calls.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}},"post":{"tags":["Andon"],"summary":"Raise an andon call","security":[{"ApiKeyAuth":[]}],"description":"A line-stopping call type also puts the station DOWN and opens a linked downtime record in the same operation.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AndonCreate"}}}},"responses":{"201":{"description":"Call raised.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Andon"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/andon/{id}":{"get":{"tags":["Andon"],"summary":"Get an andon call","parameters":[{"name":"id","in":"path","description":"Andon id.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The call.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Andon"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/andon/{id}/acknowledge":{"post":{"tags":["Andon"],"summary":"Acknowledge a call","security":[{"ApiKeyAuth":[]}],"description":"Stops the response-time clock and decides SLA attainment.","parameters":[{"name":"id","in":"path","description":"Andon id.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"responder":{"type":"string"}}},"example":{"responder":"maint-771"}}}},"responses":{"200":{"description":"Acknowledged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Andon"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/andon/{id}/escalate":{"post":{"tags":["Andon"],"summary":"Escalate a call up the ladder","security":[{"ApiKeyAuth":[]}],"parameters":[{"name":"id","in":"path","description":"Andon id.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Escalated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Andon"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/andon/{id}/resolve":{"post":{"tags":["Andon"],"summary":"Resolve a call and restart the station","security":[{"ApiKeyAuth":[]}],"parameters":[{"name":"id","in":"path","description":"Andon id.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"resolution":{"type":"string"},"resolver":{"type":"string"}}},"example":{"resolution":"Replaced servo amplifier","resolver":"maint-771"}}}},"responses":{"200":{"description":"Resolved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Andon"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/downtime":{"get":{"tags":["Downtime"],"summary":"List downtime records","parameters":[{"name":"open","in":"query","description":"Only currently-open stops.","required":false,"schema":{"type":"boolean"}},{"name":"category","in":"query","description":"Planned or unplanned.","required":false,"schema":{"type":"string","enum":["PLANNED","UNPLANNED"]}},{"name":"lineId","in":"query","description":"Filter by line.","required":false,"schema":{"type":"string","enum":["BODY","PAINT","DOOR","TIRE","SUBASM","MAINASM","QUALITY"]}},{"name":"limit","in":"query","description":"Maximum items to return (1-500).","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":50}},{"name":"offset","in":"query","description":"Items to skip, for paging.","required":false,"schema":{"type":"integer","minimum":0,"default":0}},{"name":"sort","in":"query","description":"Field to sort by.","required":false,"schema":{"type":"string"}},{"name":"order","in":"query","description":"Sort direction.","required":false,"schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"Downtime records.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}},"post":{"tags":["Downtime"],"summary":"Open a downtime record","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["stationId","reasonCode"],"properties":{"stationId":{"type":"string","enum":["BODY-10","BODY-20","BODY-30","BODY-40","BODY-50","PAINT-10","PAINT-20","PAINT-30","PAINT-40","PAINT-50","PAINT-60","DOOR-10","DOOR-20","DOOR-30","DOOR-40","DOOR-50","TIRE-10","TIRE-20","TIRE-30","TIRE-40","TIRE-50","SUB-ENG-10","SUB-ENG-20","SUB-CKP-10","SUB-SEAT-10","SUB-SUSP-10","SUB-SUSP-20","TRIM-10","TRIM-20","TRIM-30","CHAS-10","CHAS-20","CHAS-30","FINAL-10","FINAL-20","FINAL-30","FINAL-40","EOL-10","EOL-20","EOL-30","EOL-40","EOL-50","EOL-60"]},"reasonCode":{"type":"string","enum":["EQUIP_FAILURE","ROBOT_FAULT","TOOL_BREAKAGE","CONVEYOR_JAM","MATERIAL_SHORTAGE","QUALITY_HOLD","ANDON_STOP","UPSTREAM_BLOCKED","DOWNSTREAM_STARVED","OPERATOR_ABSENT","POWER_LOSS","SLOW_CYCLE","OPERATOR_STOP","CHANGEOVER","PREVENTIVE_MAINT","SCHEDULED_BREAK","SHIFT_MEETING","NO_SCHEDULE","TRIAL_BUILD"]},"note":{"type":"string"},"reportedBy":{"type":"string"}}},"example":{"stationId":"PAINT-40","reasonCode":"ROBOT_FAULT","reportedBy":"op-3312"}}}},"responses":{"201":{"description":"Opened.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Downtime"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/downtime/current":{"get":{"tags":["Downtime"],"summary":"Stations stopped right now","responses":{"200":{"description":"Open stops, longest first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}}},"/downtime/{id}/end":{"post":{"tags":["Downtime"],"summary":"Close a downtime record","security":[{"ApiKeyAuth":[]}],"parameters":[{"name":"id","in":"path","description":"Downtime id.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"rootCause":{"type":"string"},"correctiveAction":{"type":"string"},"repairedBy":{"type":"string"}}},"example":{"rootCause":"Bell atomizer bearing seizure","correctiveAction":"Replaced bell cup assembly","repairedBy":"maint-883"}}}},"responses":{"200":{"description":"Closed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Downtime"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/operations/summary":{"get":{"tags":["Downtime"],"summary":"Andon and downtime performance, with MTBF and MTTR","parameters":[{"name":"since","in":"query","description":"Window start.","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"lineId","in":"query","description":"Filter to a line.","required":false,"schema":{"type":"string","enum":["BODY","PAINT","DOOR","TIRE","SUBASM","MAINASM","QUALITY"]}}],"responses":{"200":{"description":"Operations summary.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/kpi/dashboard":{"get":{"tags":["KPI"],"summary":"The whole plant on one screen","description":"Headline OEE and throughput, quality with Pareto, station state mix, open andon calls, current stops, per-line OEE, feeder buffer levels and active work orders.","parameters":[{"name":"since","in":"query","description":"Window start. Defaults to the current shift.","required":false,"schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Dashboard payload.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/kpi/oee":{"get":{"tags":["KPI"],"summary":"Plant OEE with per-line breakdown","parameters":[{"name":"since","in":"query","description":"Window start.","required":false,"schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Plant OEE.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Oee"}}}}}}},"/kpi/calculate":{"get":{"tags":["KPI"],"summary":"Run the ISO 22400 OEE engine on your own numbers","description":"A pure calculation with no plant state - the same engine the plant uses, including the performance cap and the loss waterfall. The OEE calculator in the documentation calls this.","parameters":[{"name":"plannedBusySeconds","in":"query","description":"Shift length minus scheduled breaks.","required":false,"schema":{"type":"number","default":26400}},{"name":"plannedDowntimeSeconds","in":"query","description":"Planned stops inside the window.","required":false,"schema":{"type":"number","default":0}},{"name":"downtimeSeconds","in":"query","description":"Unplanned stops inside the window.","required":false,"schema":{"type":"number","default":0}},{"name":"totalCount","in":"query","description":"Units produced.","required":false,"schema":{"type":"number","default":0}},{"name":"goodCount","in":"query","description":"Units that passed first time.","required":false,"schema":{"type":"number","default":0}},{"name":"idealCycleSeconds","in":"query","description":"Rated cycle time.","required":false,"schema":{"type":"number","default":60}}],"responses":{"200":{"description":"OEE with losses and warnings.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Oee"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/kpi/trend":{"get":{"tags":["KPI"],"summary":"Per-shift trend","description":"Reads recomputed detail for recent shifts and stored aggregates for older ones. The current shift is truncated at now and flagged `partial`.","parameters":[{"name":"shifts","in":"query","description":"How many shifts back (1-30).","required":false,"schema":{"type":"integer","minimum":1,"maximum":30,"default":8}}],"responses":{"200":{"description":"Shift trend, oldest first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}}},"/trace/recall":{"post":{"tags":["Traceability"],"summary":"Recall analysis for a suspect lot, serial or part","description":"The query an MES exists to answer. Given a supplier batch, returns every vehicle containing it,\n\nwhere each one is now (in plant, in the yard, or shipped), an estimated containment cost, and a\n\nrecommended action. Lot lookups are O(1) against a maintained index.","security":[{"ApiKeyAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecallQuery"}}}},"responses":{"200":{"description":"Recall report.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecallReport"}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/trace/lots":{"get":{"tags":["Traceability"],"summary":"Supplier lots the plant has consumed","description":"Use this to find a lot code to feed into the recall query.","parameters":[{"name":"supplier","in":"query","description":"Filter by supplier.","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Maximum items to return (1-500).","required":false,"schema":{"type":"integer","minimum":1,"maximum":500,"default":50}},{"name":"offset","in":"query","description":"Items to skip, for paging.","required":false,"schema":{"type":"integer","minimum":0,"default":0}},{"name":"sort","in":"query","description":"Field to sort by.","required":false,"schema":{"type":"string"}},{"name":"order","in":"query","description":"Sort direction.","required":false,"schema":{"type":"string","enum":["asc","desc"],"default":"desc"}}],"responses":{"200":{"description":"Lots, most-used first.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}}}}},"/trace/lots/{lotCode}":{"get":{"tags":["Traceability"],"summary":"Where a lot was consumed","parameters":[{"name":"lotCode","in":"path","description":"Supplier lot code.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Lot usage across stations and vehicles.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/trace/vehicle/{vin}":{"get":{"tags":["Traceability"],"summary":"Complete as-built record for one vehicle","description":"Genealogy, sub-assemblies with their test results, every inspection and defect, the station route, suppliers and lot codes.","parameters":[{"name":"vin","in":"path","description":"VIN.","required":true,"schema":{"type":"string"},"example":"2NSAURE1XTW001042"}],"responses":{"200":{"description":"Vehicle trace.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/events":{"get":{"tags":["Events"],"summary":"Query the plant event log","parameters":[{"name":"type","in":"query","description":"Exact event type, e.g. unit.moved.","required":false,"schema":{"type":"string"}},{"name":"severity","in":"query","description":"Filter by severity.","required":false,"schema":{"type":"string","enum":["info","success","warning","error"]}},{"name":"lineId","in":"query","description":"Filter by line.","required":false,"schema":{"type":"string","enum":["BODY","PAINT","DOOR","TIRE","SUBASM","MAINASM","QUALITY"]}},{"name":"vin","in":"query","description":"Filter by vehicle.","required":false,"schema":{"type":"string"}},{"name":"since","in":"query","description":"Only events after this instant.","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","description":"Maximum events (default 100, max 1000).","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Events, newest first.","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Event"}},"total":{"type":"integer"}}}}}}}}},"/events/stream":{"get":{"tags":["Events"],"summary":"Live event stream (Server-Sent Events)","description":"A `text/event-stream` of everything happening on the floor. Plain HTTP, so it works through any\nproxy and needs no extra port.\n\n```js\nconst stream = new EventSource('/api/v1/events/stream?type=unit,andon');\nstream.addEventListener('unit.moved', (e) => console.log(JSON.parse(e.data)));\n```\n\nSwagger UI cannot render a streaming response - use the browser console or `curl -N`.","parameters":[{"name":"type","in":"query","description":"Comma-separated type prefixes, e.g. `unit,andon`.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"An open SSE stream.","content":{"text/event-stream":{"schema":{"type":"string"}}}}}}},"/simulator":{"get":{"tags":["Simulator"],"summary":"Simulator status","responses":{"200":{"description":"Status.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/simulator/{action}":{"post":{"tags":["Simulator"],"summary":"Control the simulated plant","security":[{"ApiKeyAuth":[]}],"description":"| Action | Body | Effect |\n| --- | --- | --- |\n| `start` / `stop` | - | Run or pause production |\n| `speed` | `{ \"speed\": 30 }` | 1 = real time, 30 = a 60 s takt every 2 s |\n| `inject-fault` | `{ \"stationId\": \"PAINT-40\", \"reasonCode\": \"ROBOT_FAULT\", \"durationSeconds\": 240 }` | Break a station |\n| `inject-defect` | `{ \"vin\": \"...\", \"code\": \"TORQUE_LOW\" }` | Raise a defect on a vehicle |","parameters":[{"name":"action","in":"path","description":"Control action.","required":true,"schema":{"type":"string","enum":["start","stop","speed","inject-fault","inject-defect"]}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true},"example":{"speed":30}}}},"responses":{"200":{"description":"Result of the action.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"The request failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"A valid API key is required for this operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"The requested resource does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The operation conflicts with the current state of the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many state-changing requests from this client; see Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}