{"openapi":"3.1.0","info":{"title":"Print Platform API","description":"REST API for managing a 3D printing side business: model pricing, sales, profit splits, forecasting.","version":"0.1.0"},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{}},"paths":{"/api/v1/health":{"get":{"summary":"Health check (includes DB reachability)","tags":["health"],"security":[],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded"]},"timestamp":{"type":"string","format":"date-time"},"uptime":{"type":"number"},"dbLatencyMs":{"type":"number","nullable":true}},"required":["status","timestamp","uptime","dbLatencyMs"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded"]},"timestamp":{"type":"string","format":"date-time"},"uptime":{"type":"number"},"dbLatencyMs":{"type":"number","nullable":true}},"required":["status","timestamp","uptime","dbLatencyMs"],"additionalProperties":false}}}}}}},"/api/v1/auth/register":{"post":{"summary":"Register a new user. Owner-only except for the bootstrap user.","tags":["auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":8},"name":{"type":"string","minLength":1,"maxLength":100},"role":{"type":"string","enum":["owner","seller"]},"sellerId":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true}},"required":["email","password"],"additionalProperties":false}}}},"security":[],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"accessToken":{"type":"string"},"refreshToken":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","seller"]},"sellerId":{"type":"integer","nullable":true}},"required":["id","email","name","role","sellerId"],"additionalProperties":false}},"required":["accessToken","refreshToken","user"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/auth/login":{"post":{"summary":"Exchange email + password for access and refresh tokens","tags":["auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":1}},"required":["email","password"],"additionalProperties":false}}}},"security":[],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"accessToken":{"type":"string"},"refreshToken":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","seller"]},"sellerId":{"type":"integer","nullable":true}},"required":["id","email","name","role","sellerId"],"additionalProperties":false}},"required":["accessToken","refreshToken","user"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/auth/refresh":{"post":{"summary":"Exchange a refresh token for a new pair (rotates the refresh token)","tags":["auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"refreshToken":{"type":"string","minLength":1}},"required":["refreshToken"],"additionalProperties":false}}}},"security":[],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"accessToken":{"type":"string"},"refreshToken":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","seller"]},"sellerId":{"type":"integer","nullable":true}},"required":["id","email","name","role","sellerId"],"additionalProperties":false}},"required":["accessToken","refreshToken","user"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/auth/logout":{"post":{"summary":"Revoke a refresh token","tags":["auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"refreshToken":{"type":"string","minLength":1}},"required":["refreshToken"],"additionalProperties":false}}}},"security":[],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/auth/me":{"get":{"summary":"Get the authenticated user","tags":["auth"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":"string","nullable":true},"displayInitials":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","seller"]},"sellerId":{"type":"integer","nullable":true},"ownerSellerId":{"type":"integer","nullable":true},"isActive":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","email","name","displayInitials","role","sellerId","ownerSellerId","isActive","createdAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/global-settings":{"get":{"summary":"Get the current global configuration","tags":["global-settings"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"intendedMargin":{"type":"number"},"defaultWholesaleMultiplier":{"type":"number"},"fallbackIntendedMargin":{"type":"number"},"fallbackItemsPerTray":{"type":"integer"},"marginWarnThreshold":{"type":"number"},"defaultLabourMin":{"type":"number"},"defaultPrinterFailureFactor":{"type":"number"},"defaultSpoolWeightG":{"type":"number"},"defaultReorderThresholdG":{"type":"number"},"defaultFilamentCostPerKg":{"type":"number"},"currency":{"type":"string"},"locale":{"type":"string"},"failureFactorMin":{"type":"number"},"failureFactorMax":{"type":"number"},"woocommerceSyncEnabled":{"type":"boolean"},"woocommerceDefaultStatus":{"type":"string","enum":["draft","publish","private"]},"woocommerceAutoPushPrintJobStock":{"type":"boolean"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","intendedMargin","defaultWholesaleMultiplier","fallbackIntendedMargin","fallbackItemsPerTray","marginWarnThreshold","defaultLabourMin","defaultPrinterFailureFactor","defaultSpoolWeightG","defaultReorderThresholdG","defaultFilamentCostPerKg","currency","locale","failureFactorMin","failureFactorMax","woocommerceSyncEnabled","woocommerceDefaultStatus","woocommerceAutoPushPrintJobStock","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update one or more global configuration values (owner-only)","tags":["global-settings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"intendedMargin":{"type":"number","exclusiveMinimum":true,"minimum":0,"maximum":1},"defaultWholesaleMultiplier":{"type":"number","exclusiveMinimum":true,"minimum":0,"maximum":1},"fallbackIntendedMargin":{"type":"number","exclusiveMinimum":true,"minimum":0,"maximum":1},"fallbackItemsPerTray":{"type":"integer","exclusiveMinimum":true,"minimum":0},"marginWarnThreshold":{"type":"number","minimum":0,"maximum":1},"defaultLabourMin":{"type":"number","minimum":0},"defaultPrinterFailureFactor":{"type":"number","minimum":1},"defaultSpoolWeightG":{"type":"number","exclusiveMinimum":true,"minimum":0},"defaultReorderThresholdG":{"type":"number","minimum":0},"defaultFilamentCostPerKg":{"type":"number","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"locale":{"type":"string","minLength":2,"maxLength":35},"failureFactorMin":{"type":"number","minimum":1},"failureFactorMax":{"type":"number","minimum":1},"woocommerceSyncEnabled":{"type":"boolean"},"woocommerceDefaultStatus":{"type":"string","enum":["draft","publish","private"]},"woocommerceAutoPushPrintJobStock":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"intendedMargin":{"type":"number"},"defaultWholesaleMultiplier":{"type":"number"},"fallbackIntendedMargin":{"type":"number"},"fallbackItemsPerTray":{"type":"integer"},"marginWarnThreshold":{"type":"number"},"defaultLabourMin":{"type":"number"},"defaultPrinterFailureFactor":{"type":"number"},"defaultSpoolWeightG":{"type":"number"},"defaultReorderThresholdG":{"type":"number"},"defaultFilamentCostPerKg":{"type":"number"},"currency":{"type":"string"},"locale":{"type":"string"},"failureFactorMin":{"type":"number"},"failureFactorMax":{"type":"number"},"woocommerceSyncEnabled":{"type":"boolean"},"woocommerceDefaultStatus":{"type":"string","enum":["draft","publish","private"]},"woocommerceAutoPushPrintJobStock":{"type":"boolean"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","intendedMargin","defaultWholesaleMultiplier","fallbackIntendedMargin","fallbackItemsPerTray","marginWarnThreshold","defaultLabourMin","defaultPrinterFailureFactor","defaultSpoolWeightG","defaultReorderThresholdG","defaultFilamentCostPerKg","currency","locale","failureFactorMin","failureFactorMax","woocommerceSyncEnabled","woocommerceDefaultStatus","woocommerceAutoPushPrintJobStock","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/printers":{"get":{"summary":"List printers","tags":["printers"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"boolean"},"in":"query","name":"activeOnly","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"modelType":{"type":"string"},"hasAms":{"type":"boolean"},"electricityPerMin":{"type":"number"},"machinePerMin":{"type":"number"},"baseFailureFactor":{"type":"number"},"isActive":{"type":"boolean"},"ownerSellerId":{"type":"integer","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","modelType","hasAms","electricityPerMin","machinePerMin","baseFailureFactor","isActive","ownerSellerId","notes","createdAt","updatedAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"post":{"summary":"Create a printer","tags":["printers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"modelType":{"type":"string","minLength":1,"maxLength":50},"hasAms":{"type":"boolean"},"electricityPerMin":{"type":"number","minimum":0},"machinePerMin":{"type":"number","minimum":0},"baseFailureFactor":{"type":"number","exclusiveMinimum":true,"minimum":0},"isActive":{"type":"boolean"},"ownerSellerId":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"notes":{"type":"string","maxLength":2000,"nullable":true}},"required":["name","modelType","electricityPerMin","machinePerMin"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"modelType":{"type":"string"},"hasAms":{"type":"boolean"},"electricityPerMin":{"type":"number"},"machinePerMin":{"type":"number"},"baseFailureFactor":{"type":"number"},"isActive":{"type":"boolean"},"ownerSellerId":{"type":"integer","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","modelType","hasAms","electricityPerMin","machinePerMin","baseFailureFactor","isActive","ownerSellerId","notes","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/printers/{id}":{"get":{"summary":"Get a printer by ID","tags":["printers"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"modelType":{"type":"string"},"hasAms":{"type":"boolean"},"electricityPerMin":{"type":"number"},"machinePerMin":{"type":"number"},"baseFailureFactor":{"type":"number"},"isActive":{"type":"boolean"},"ownerSellerId":{"type":"integer","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","modelType","hasAms","electricityPerMin","machinePerMin","baseFailureFactor","isActive","ownerSellerId","notes","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update a printer","tags":["printers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"modelType":{"type":"string","minLength":1,"maxLength":50},"hasAms":{"type":"boolean"},"electricityPerMin":{"type":"number","minimum":0},"machinePerMin":{"type":"number","minimum":0},"baseFailureFactor":{"type":"number","exclusiveMinimum":true,"minimum":0},"isActive":{"type":"boolean"},"ownerSellerId":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"notes":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"modelType":{"type":"string"},"hasAms":{"type":"boolean"},"electricityPerMin":{"type":"number"},"machinePerMin":{"type":"number"},"baseFailureFactor":{"type":"number"},"isActive":{"type":"boolean"},"ownerSellerId":{"type":"integer","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","modelType","hasAms","electricityPerMin","machinePerMin","baseFailureFactor","isActive","ownerSellerId","notes","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Soft-delete a printer (sets isActive=false)","tags":["printers"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/complexity-tiers":{"get":{"summary":"List complexity tiers","tags":["complexity-tiers"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":50},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"sortOrder":{"type":"integer"},"description":{"type":"string","nullable":true}},"required":["id","name","sortOrder","description"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"post":{"summary":"Create a complexity tier","tags":["complexity-tiers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":50},"sortOrder":{"type":"integer","minimum":0},"description":{"type":"string","maxLength":500,"nullable":true}},"required":["name"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"sortOrder":{"type":"integer"},"description":{"type":"string","nullable":true}},"required":["id","name","sortOrder","description"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/complexity-tiers/{id}":{"get":{"summary":"Get a complexity tier","tags":["complexity-tiers"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"sortOrder":{"type":"integer"},"description":{"type":"string","nullable":true}},"required":["id","name","sortOrder","description"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update a complexity tier","tags":["complexity-tiers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":50},"sortOrder":{"type":"integer","minimum":0},"description":{"type":"string","maxLength":500,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"sortOrder":{"type":"integer"},"description":{"type":"string","nullable":true}},"required":["id","name","sortOrder","description"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Delete a complexity tier","tags":["complexity-tiers"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/designers":{"get":{"summary":"List designers","tags":["designers"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":50},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"code":{"type":"string"},"websiteUrl":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","code","websiteUrl","notes","createdAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"post":{"summary":"Create a designer","tags":["designers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"code":{"type":"string","minLength":1,"maxLength":10,"pattern":"^[A-Z0-9]+$"},"websiteUrl":{"type":"string","format":"uri","nullable":true},"notes":{"type":"string","maxLength":2000,"nullable":true}},"required":["name","code"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"code":{"type":"string"},"websiteUrl":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","code","websiteUrl","notes","createdAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/designers/{id}":{"get":{"summary":"Get a designer","tags":["designers"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"code":{"type":"string"},"websiteUrl":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","code","websiteUrl","notes","createdAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update a designer","tags":["designers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"code":{"type":"string","minLength":1,"maxLength":10,"pattern":"^[A-Z0-9]+$"},"websiteUrl":{"type":"string","format":"uri","nullable":true},"notes":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"code":{"type":"string"},"websiteUrl":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","code","websiteUrl","notes","createdAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Delete a designer","tags":["designers"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/filaments":{"get":{"summary":"List filaments","tags":["filaments"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"boolean"},"in":"query","name":"activeOnly","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"brand":{"type":"string"},"material":{"type":"string"},"colour":{"type":"string"},"colourHex":{"type":"string","nullable":true},"costPerKg":{"type":"number"},"spoolWeightG":{"type":"number"},"estimatedRemainingG":{"type":"number"},"reorderThresholdG":{"type":"number","nullable":true},"supplierId":{"type":"integer","nullable":true},"supplierName":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"spoolCount":{"type":"integer"},"spools":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"label":{"type":"string"},"initialWeightG":{"type":"number"},"remainingG":{"type":"number"},"costPerKg":{"type":"number"},"purchasedAt":{"type":"string","format":"date-time"},"purchaseId":{"type":"integer","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","filamentId","label","initialWeightG","remainingG","costPerKg","purchasedAt","purchaseId","isActive","notes","createdAt","updatedAt"],"additionalProperties":false}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","brand","material","colour","colourHex","costPerKg","spoolWeightG","estimatedRemainingG","reorderThresholdG","supplierId","supplierName","isActive","notes","spoolCount","spools","createdAt","updatedAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"post":{"summary":"Create a filament","tags":["filaments"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"brand":{"type":"string","minLength":1,"maxLength":50},"material":{"type":"string","minLength":1,"maxLength":50},"colour":{"type":"string","minLength":1,"maxLength":50},"colourHex":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","nullable":true},"costPerKg":{"type":"number","exclusiveMinimum":true,"minimum":0},"spoolWeightG":{"type":"number","exclusiveMinimum":true,"minimum":0},"estimatedRemainingG":{"type":"number","minimum":0},"reorderThresholdG":{"type":"number","minimum":0,"nullable":true},"supplierId":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","maxLength":2000,"nullable":true}},"required":["brand","material","colour","costPerKg"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"brand":{"type":"string"},"material":{"type":"string"},"colour":{"type":"string"},"colourHex":{"type":"string","nullable":true},"costPerKg":{"type":"number"},"spoolWeightG":{"type":"number"},"estimatedRemainingG":{"type":"number"},"reorderThresholdG":{"type":"number","nullable":true},"supplierId":{"type":"integer","nullable":true},"supplierName":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"spoolCount":{"type":"integer"},"spools":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"label":{"type":"string"},"initialWeightG":{"type":"number"},"remainingG":{"type":"number"},"costPerKg":{"type":"number"},"purchasedAt":{"type":"string","format":"date-time"},"purchaseId":{"type":"integer","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","filamentId","label","initialWeightG","remainingG","costPerKg","purchasedAt","purchaseId","isActive","notes","createdAt","updatedAt"],"additionalProperties":false}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","brand","material","colour","colourHex","costPerKg","spoolWeightG","estimatedRemainingG","reorderThresholdG","supplierId","supplierName","isActive","notes","spoolCount","spools","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/filaments/{id}":{"get":{"summary":"Get a filament","tags":["filaments"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"brand":{"type":"string"},"material":{"type":"string"},"colour":{"type":"string"},"colourHex":{"type":"string","nullable":true},"costPerKg":{"type":"number"},"spoolWeightG":{"type":"number"},"estimatedRemainingG":{"type":"number"},"reorderThresholdG":{"type":"number","nullable":true},"supplierId":{"type":"integer","nullable":true},"supplierName":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"spoolCount":{"type":"integer"},"spools":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"label":{"type":"string"},"initialWeightG":{"type":"number"},"remainingG":{"type":"number"},"costPerKg":{"type":"number"},"purchasedAt":{"type":"string","format":"date-time"},"purchaseId":{"type":"integer","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","filamentId","label","initialWeightG","remainingG","costPerKg","purchasedAt","purchaseId","isActive","notes","createdAt","updatedAt"],"additionalProperties":false}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","brand","material","colour","colourHex","costPerKg","spoolWeightG","estimatedRemainingG","reorderThresholdG","supplierId","supplierName","isActive","notes","spoolCount","spools","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update a filament","tags":["filaments"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"brand":{"type":"string","minLength":1,"maxLength":50},"material":{"type":"string","minLength":1,"maxLength":50},"colour":{"type":"string","minLength":1,"maxLength":50},"colourHex":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","nullable":true},"reorderThresholdG":{"type":"number","minimum":0,"nullable":true},"supplierId":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"brand":{"type":"string"},"material":{"type":"string"},"colour":{"type":"string"},"colourHex":{"type":"string","nullable":true},"costPerKg":{"type":"number"},"spoolWeightG":{"type":"number"},"estimatedRemainingG":{"type":"number"},"reorderThresholdG":{"type":"number","nullable":true},"supplierId":{"type":"integer","nullable":true},"supplierName":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"spoolCount":{"type":"integer"},"spools":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"label":{"type":"string"},"initialWeightG":{"type":"number"},"remainingG":{"type":"number"},"costPerKg":{"type":"number"},"purchasedAt":{"type":"string","format":"date-time"},"purchaseId":{"type":"integer","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","filamentId","label","initialWeightG","remainingG","costPerKg","purchasedAt","purchaseId","isActive","notes","createdAt","updatedAt"],"additionalProperties":false}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","brand","material","colour","colourHex","costPerKg","spoolWeightG","estimatedRemainingG","reorderThresholdG","supplierId","supplierName","isActive","notes","spoolCount","spools","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Soft-delete a filament","tags":["filaments"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/filaments/{id}/adjust-stock":{"post":{"summary":"Adjust estimated remaining stock by a signed delta","tags":["filaments"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deltaG":{"type":"number","description":"Positive to add, negative to subtract"},"reason":{"type":"string","maxLength":200}},"required":["deltaG"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"brand":{"type":"string"},"material":{"type":"string"},"colour":{"type":"string"},"colourHex":{"type":"string","nullable":true},"costPerKg":{"type":"number"},"spoolWeightG":{"type":"number"},"estimatedRemainingG":{"type":"number"},"reorderThresholdG":{"type":"number","nullable":true},"supplierId":{"type":"integer","nullable":true},"supplierName":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"spoolCount":{"type":"integer"},"spools":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"label":{"type":"string"},"initialWeightG":{"type":"number"},"remainingG":{"type":"number"},"costPerKg":{"type":"number"},"purchasedAt":{"type":"string","format":"date-time"},"purchaseId":{"type":"integer","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","filamentId","label","initialWeightG","remainingG","costPerKg","purchasedAt","purchaseId","isActive","notes","createdAt","updatedAt"],"additionalProperties":false}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","brand","material","colour","colourHex","costPerKg","spoolWeightG","estimatedRemainingG","reorderThresholdG","supplierId","supplierName","isActive","notes","spoolCount","spools","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/filament-spools":{"get":{"summary":"List spools, optionally filtered by filamentId or isActive","tags":["filaments"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"filamentId","required":false},{"schema":{"type":"boolean"},"in":"query","name":"activeOnly","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"label":{"type":"string"},"initialWeightG":{"type":"number"},"remainingG":{"type":"number"},"costPerKg":{"type":"number"},"purchasedAt":{"type":"string","format":"date-time"},"purchaseId":{"type":"integer","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","filamentId","label","initialWeightG","remainingG","costPerKg","purchasedAt","purchaseId","isActive","notes","createdAt","updatedAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"post":{"summary":"Create a new spool against an existing filament","tags":["filaments"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"filamentId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"label":{"type":"string","minLength":1,"maxLength":50},"initialWeightG":{"type":"number","exclusiveMinimum":true,"minimum":0},"remainingG":{"type":"number","minimum":0},"costPerKg":{"type":"number","exclusiveMinimum":true,"minimum":0},"purchasedAt":{"type":"string","format":"date-time"},"isActive":{"type":"boolean"},"notes":{"type":"string","maxLength":2000,"nullable":true}},"required":["filamentId","label","initialWeightG","costPerKg"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"label":{"type":"string"},"initialWeightG":{"type":"number"},"remainingG":{"type":"number"},"costPerKg":{"type":"number"},"purchasedAt":{"type":"string","format":"date-time"},"purchaseId":{"type":"integer","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","filamentId","label","initialWeightG","remainingG","costPerKg","purchasedAt","purchaseId","isActive","notes","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/filament-spools/{id}":{"get":{"summary":"Get a single spool","tags":["filaments"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"label":{"type":"string"},"initialWeightG":{"type":"number"},"remainingG":{"type":"number"},"costPerKg":{"type":"number"},"purchasedAt":{"type":"string","format":"date-time"},"purchaseId":{"type":"integer","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","filamentId","label","initialWeightG","remainingG","costPerKg","purchasedAt","purchaseId","isActive","notes","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update a spool","tags":["filaments"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":50},"initialWeightG":{"type":"number","exclusiveMinimum":true,"minimum":0},"remainingG":{"type":"number","minimum":0},"costPerKg":{"type":"number","exclusiveMinimum":true,"minimum":0},"purchasedAt":{"type":"string","format":"date-time"},"isActive":{"type":"boolean"},"notes":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"label":{"type":"string"},"initialWeightG":{"type":"number"},"remainingG":{"type":"number"},"costPerKg":{"type":"number"},"purchasedAt":{"type":"string","format":"date-time"},"purchaseId":{"type":"integer","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","filamentId","label","initialWeightG","remainingG","costPerKg","purchasedAt","purchaseId","isActive","notes","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Soft-delete (deactivate) a spool","tags":["filaments"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/filament-spools/{id}/adjust":{"post":{"summary":"Adjust remaining weight on a spool by a signed delta","tags":["filaments"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deltaG":{"type":"number","description":"Positive to add, negative to subtract"},"reason":{"type":"string","maxLength":200}},"required":["deltaG"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"label":{"type":"string"},"initialWeightG":{"type":"number"},"remainingG":{"type":"number"},"costPerKg":{"type":"number"},"purchasedAt":{"type":"string","format":"date-time"},"purchaseId":{"type":"integer","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","filamentId","label","initialWeightG","remainingG","costPerKg","purchasedAt","purchaseId","isActive","notes","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/filament-brands":{"get":{"summary":"List filament brands","tags":["filament-brands"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","createdAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"post":{"summary":"Create a filament brand","tags":["filament-brands"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100}},"required":["name"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","createdAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/filament-brands/{id}":{"delete":{"summary":"Delete a filament brand","tags":["filament-brands"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/filament-materials":{"get":{"summary":"List filament materials","tags":["filament-materials"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","createdAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"post":{"summary":"Create a filament material","tags":["filament-materials"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100}},"required":["name"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","createdAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/filament-materials/{id}":{"delete":{"summary":"Delete a filament material","tags":["filament-materials"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/filament-purchases":{"get":{"summary":"List filament purchases (most recent first)","tags":["filament-purchases"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"filamentId","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"supplierId","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"supplierId":{"type":"integer","nullable":true},"supplierName":{"type":"string","nullable":true},"weightG":{"type":"number","minimum":0},"costPerKg":{"type":"number","minimum":0},"purchasedAt":{"type":"string","format":"date-time"},"tracking":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","filamentId","supplierId","supplierName","weightG","costPerKg","purchasedAt","tracking","notes","createdAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"post":{"summary":"Record a filament purchase (atomically bumps remaining stock)","tags":["filament-purchases"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"filamentId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"supplierId":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"weightG":{"type":"number","exclusiveMinimum":true,"minimum":0},"costPerKg":{"type":"number","exclusiveMinimum":true,"minimum":0},"purchasedAt":{"type":"string","format":"date-time"},"tracking":{"type":"string","maxLength":200,"nullable":true},"notes":{"type":"string","maxLength":2000,"nullable":true},"spoolLabel":{"type":"string","minLength":1,"maxLength":50}},"required":["filamentId","weightG","costPerKg"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"supplierId":{"type":"integer","nullable":true},"supplierName":{"type":"string","nullable":true},"weightG":{"type":"number","minimum":0},"costPerKg":{"type":"number","minimum":0},"purchasedAt":{"type":"string","format":"date-time"},"tracking":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","filamentId","supplierId","supplierName","weightG","costPerKg","purchasedAt","tracking","notes","createdAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/suppliers":{"get":{"summary":"List suppliers","tags":["suppliers"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"websiteUrl":{"type":"string","nullable":true},"orderingNotes":{"type":"string","nullable":true},"contact":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","websiteUrl","orderingNotes","contact","isActive","notes","createdAt","updatedAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"post":{"summary":"Create a supplier","tags":["suppliers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"websiteUrl":{"type":"string","format":"uri","nullable":true},"orderingNotes":{"type":"string","maxLength":2000,"nullable":true},"contact":{"type":"string","maxLength":500,"nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","maxLength":2000,"nullable":true}},"required":["name"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"websiteUrl":{"type":"string","nullable":true},"orderingNotes":{"type":"string","nullable":true},"contact":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","websiteUrl","orderingNotes","contact","isActive","notes","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/suppliers/{id}":{"get":{"summary":"Get a supplier","tags":["suppliers"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"websiteUrl":{"type":"string","nullable":true},"orderingNotes":{"type":"string","nullable":true},"contact":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","websiteUrl","orderingNotes","contact","isActive","notes","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update a supplier","tags":["suppliers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"websiteUrl":{"type":"string","format":"uri","nullable":true},"orderingNotes":{"type":"string","maxLength":2000,"nullable":true},"contact":{"type":"string","maxLength":500,"nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"websiteUrl":{"type":"string","nullable":true},"orderingNotes":{"type":"string","nullable":true},"contact":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","websiteUrl","orderingNotes","contact","isActive","notes","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Soft-delete (deactivate) a supplier","tags":["suppliers"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/sellers":{"get":{"summary":"List sellers with their linked user (if any)","tags":["sellers"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"isOwner":{"type":"boolean"},"notes":{"type":"string","nullable":true},"userName":{"type":"string","nullable":true},"userEmail":{"type":"string","format":"email","nullable":true},"userInitials":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","isOwner","notes","userName","userEmail","userInitials","createdAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}}},"/api/v1/users":{"get":{"summary":"List user accounts (owner-only)","tags":["users"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":"string","nullable":true},"displayInitials":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","seller"]},"sellerId":{"type":"integer","nullable":true},"sellerName":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","email","name","displayInitials","role","sellerId","sellerName","isActive","createdAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}}},"/api/v1/users/{id}":{"patch":{"summary":"Update a user (owner-only)","tags":["users"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"displayInitials":{"type":"string","maxLength":8,"nullable":true},"role":{"type":"string","enum":["owner","seller"]},"sellerId":{"type":"integer","nullable":true},"isActive":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":"string","nullable":true},"displayInitials":{"type":"string","nullable":true},"role":{"type":"string","enum":["owner","seller"]},"sellerId":{"type":"integer","nullable":true},"sellerName":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","email","name","displayInitials","role","sellerId","sellerName","isActive","createdAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/inventory":{"get":{"summary":"List inventory rows (sellers see only their own)","tags":["inventory"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"sellerId","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"modelId","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"sellerId":{"type":"integer"},"modelId":{"type":"integer"},"qty":{"type":"integer"},"websiteAvailableQty":{"type":"integer"},"updatedAt":{"type":"string","format":"date-time"}},"required":["sellerId","modelId","qty","websiteAvailableQty","updatedAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}}},"/api/v1/inventory/{sellerId}/{modelId}":{"get":{"summary":"Get the inventory row for a specific (seller, model) pair. Returns 404 if no row exists.","tags":["inventory"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"sellerId","required":true},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"modelId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"sellerId":{"type":"integer"},"modelId":{"type":"integer"},"qty":{"type":"integer"},"websiteAvailableQty":{"type":"integer"},"updatedAt":{"type":"string","format":"date-time"}},"required":["sellerId","modelId","qty","websiteAvailableQty","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/inventory/adjust":{"post":{"summary":"Manual inventory adjustment by signed delta (owner-only). For corrections when physical and system stock diverge.","tags":["inventory"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sellerId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"modelId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"deltaQty":{"type":"integer"},"deltaWebsiteAvailableQty":{"type":"integer","default":0},"reason":{"type":"string","minLength":1,"maxLength":500}},"required":["sellerId","modelId","deltaQty","reason"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"sellerId":{"type":"integer"},"modelId":{"type":"integer"},"qty":{"type":"integer"},"websiteAvailableQty":{"type":"integer"},"updatedAt":{"type":"string","format":"date-time"}},"required":["sellerId","modelId","qty","websiteAvailableQty","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/inventory/set-website-available":{"post":{"summary":"Set the WooCommerce-exposed qty for a (seller, model) row to an absolute value (owner-only).","tags":["inventory"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sellerId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"modelId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"websiteAvailableQty":{"type":"integer","minimum":0},"reason":{"type":"string","minLength":1,"maxLength":500}},"required":["sellerId","modelId","websiteAvailableQty","reason"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"sellerId":{"type":"integer"},"modelId":{"type":"integer"},"qty":{"type":"integer"},"websiteAvailableQty":{"type":"integer"},"updatedAt":{"type":"string","format":"date-time"}},"required":["sellerId","modelId","qty","websiteAvailableQty","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/inventory/transactions":{"get":{"summary":"Unified list of inventory movements (sales, print jobs, rejections, transfers, manual adjustments)","tags":["inventory"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"sellerId","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"modelId","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":500,"default":200},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["sale","print_job","rejection","transfer_out","transfer_in","adjustment"]},"sellerId":{"type":"integer"},"modelId":{"type":"integer"},"deltaQty":{"type":"integer"},"effectiveAt":{"type":"string","format":"date-time"},"refId":{"type":"integer"},"summary":{"type":"string"},"metadata":{"type":"object","additionalProperties":{},"nullable":true}},"required":["id","type","sellerId","modelId","deltaQty","effectiveAt","refId","summary","metadata"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/labour-rates":{"get":{"summary":"List all labour rates","tags":["labour-rates"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"printerId","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"printerId":{"type":"integer"},"complexityTierId":{"type":"integer"},"ratePerHour":{"type":"number"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","printerId","complexityTierId","ratePerHour","updatedAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"put":{"summary":"Upsert a labour rate by (printerId, complexityTierId) (owner-only)","tags":["labour-rates"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"printerId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"complexityTierId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"ratePerHour":{"type":"number","minimum":0}},"required":["printerId","complexityTierId","ratePerHour"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"printerId":{"type":"integer"},"complexityTierId":{"type":"integer"},"ratePerHour":{"type":"number"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","printerId","complexityTierId","ratePerHour","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/labour-rates/{id}":{"delete":{"summary":"Delete a labour rate","tags":["labour-rates"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/markets":{"get":{"summary":"List markets","tags":["markets"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"boolean"},"in":"query","name":"activeOnly","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"location":{"type":"string","nullable":true},"defaultSellerId":{"type":"integer","nullable":true},"siteFee":{"type":"number","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true}},"required":["id","name","location","defaultSellerId","siteFee","isActive","notes"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"post":{"summary":"Create a market (owner-only)","tags":["markets"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"location":{"type":"string","maxLength":500,"nullable":true},"defaultSellerId":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"siteFee":{"type":"number","minimum":0,"nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","maxLength":2000,"nullable":true}},"required":["name"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"location":{"type":"string","nullable":true},"defaultSellerId":{"type":"integer","nullable":true},"siteFee":{"type":"number","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true}},"required":["id","name","location","defaultSellerId","siteFee","isActive","notes"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/markets/{id}":{"get":{"summary":"Get a market by id","tags":["markets"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"location":{"type":"string","nullable":true},"defaultSellerId":{"type":"integer","nullable":true},"siteFee":{"type":"number","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true}},"required":["id","name","location","defaultSellerId","siteFee","isActive","notes"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update a market (owner-only)","tags":["markets"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"location":{"type":"string","maxLength":500,"nullable":true},"defaultSellerId":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"siteFee":{"type":"number","minimum":0,"nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"location":{"type":"string","nullable":true},"defaultSellerId":{"type":"integer","nullable":true},"siteFee":{"type":"number","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true}},"required":["id","name","location","defaultSellerId","siteFee","isActive","notes"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Soft-delete a market (sets isActive=false; historical sales keep the FK)","tags":["markets"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/models":{"get":{"summary":"List models with live pricing","tags":["models"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"boolean"},"in":"query","name":"activeOnly","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"designerId","required":false},{"schema":{"type":"string"},"in":"query","name":"q","required":false},{"schema":{"type":"string","minLength":1},"in":"query","name":"material","required":false},{"schema":{"type":"string","minLength":1},"in":"query","name":"colour","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"designerId":{"type":"integer","nullable":true},"complexityTierId":{"type":"integer"},"preferredPrinterId":{"type":"integer","nullable":true},"printedBySellerId":{"type":"integer"},"variantLabel":{"type":"string"},"printTimeMin":{"type":"number","minimum":0},"labourMin":{"type":"number","minimum":0},"itemsPerTray":{"type":"integer","exclusiveMinimum":true,"minimum":0},"failureFactorOverride":{"type":"number","nullable":true},"retailOverride":{"type":"number","nullable":true},"wholesaleOverride":{"type":"number","nullable":true},"primaryFilamentId":{"type":"integer","nullable":true},"primaryFilamentEffectiveId":{"type":"integer","nullable":true},"sku":{"type":"string","nullable":true},"imageUrl":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"pushToWoocommerce":{"type":"boolean"},"woocommerceProductId":{"type":"integer","nullable":true},"woocommerceVariationId":{"type":"integer","nullable":true},"woocommerceStatus":{"type":"string","enum":["draft","publish","private"],"nullable":true},"woocommerceSyncedAt":{"type":"string","format":"date-time","nullable":true},"filamentWeightG":{"type":"number","minimum":0},"filamentWasteG":{"type":"number","minimum":0},"hasFilamentBreakdown":{"type":"boolean"},"filaments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"weightG":{"type":"number","minimum":0},"wasteG":{"type":"number","minimum":0},"sortOrder":{"type":"integer","minimum":0},"brand":{"type":"string"},"material":{"type":"string"},"colour":{"type":"string"}},"required":["id","filamentId","weightG","wasteG","sortOrder","brand","material","colour"],"additionalProperties":false}},"pricing":{"type":"object","properties":{"timeCost":{"type":"number"},"filamentCost":{"type":"number"},"filamentCostBreakdown":{"type":"array","items":{"type":"object","properties":{"costPerKg":{"type":"number"},"weightG":{"type":"number"},"wasteG":{"type":"number"},"partCost":{"type":"number"},"wasteCost":{"type":"number"},"totalCost":{"type":"number"}},"required":["costPerKg","weightG","wasteG","partCost","wasteCost","totalCost"],"additionalProperties":false}},"labourCost":{"type":"number"},"totalWasteG":{"type":"number"},"costPerTray":{"type":"number"},"costPerItem":{"type":"number"},"calculatedRetail":{"type":"number"},"effectiveRetail":{"type":"number"},"calculatedWholesale":{"type":"number"},"effectiveWholesale":{"type":"number"},"profitPerItem":{"type":"number"},"profitPerHour":{"type":"number"},"gpMargin":{"type":"number"},"effectiveFailureFactor":{"type":"number"},"retailIsOverridden":{"type":"boolean"},"wholesaleIsOverridden":{"type":"boolean"},"marginShrinkWarning":{"type":"object","properties":{"kind":{"type":"string","enum":["retail-override","wholesale-override"]},"message":{"type":"string"},"costPerItem":{"type":"number"},"overrideValue":{"type":"number"},"marginRemaining":{"type":"number"}},"required":["kind","message","costPerItem","overrideValue","marginRemaining"],"additionalProperties":false,"nullable":true}},"required":["timeCost","filamentCost","filamentCostBreakdown","labourCost","totalWasteG","costPerTray","costPerItem","calculatedRetail","effectiveRetail","calculatedWholesale","effectiveWholesale","profitPerItem","profitPerHour","gpMargin","effectiveFailureFactor","retailIsOverridden","wholesaleIsOverridden","marginShrinkWarning"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","designerId","complexityTierId","preferredPrinterId","printedBySellerId","variantLabel","printTimeMin","labourMin","itemsPerTray","failureFactorOverride","retailOverride","wholesaleOverride","primaryFilamentId","primaryFilamentEffectiveId","sku","imageUrl","isActive","notes","pushToWoocommerce","woocommerceProductId","woocommerceVariationId","woocommerceStatus","woocommerceSyncedAt","filamentWeightG","filamentWasteG","hasFilamentBreakdown","filaments","pricing","createdAt","updatedAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"},"total":{"type":"integer","minimum":0}},"required":["nextCursor","hasMore","limit","total"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"post":{"summary":"Create a model in either aggregate or detailed filament state","tags":["models"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"designerId":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"complexityTierId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"preferredPrinterId":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"printedBySellerId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"variantLabel":{"type":"string","maxLength":60},"printTimeMin":{"type":"number","minimum":0},"labourMin":{"type":"number","minimum":0},"itemsPerTray":{"type":"integer","exclusiveMinimum":true,"minimum":0},"failureFactorOverride":{"type":"number","exclusiveMinimum":true,"minimum":0,"nullable":true},"retailOverride":{"type":"number","minimum":0,"nullable":true},"wholesaleOverride":{"type":"number","minimum":0,"nullable":true},"primaryFilamentId":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"sku":{"type":"string","maxLength":50,"nullable":true},"imageUrl":{"type":"string","format":"uri","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","maxLength":2000,"nullable":true},"pushToWoocommerce":{"type":"boolean"},"filamentSource":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["aggregate"]},"weightG":{"type":"number","minimum":0},"wasteG":{"type":"number","minimum":0,"default":0}},"required":["kind","weightG"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["detailed"]},"rows":{"type":"array","items":{"type":"object","properties":{"filamentId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"weightG":{"type":"number","minimum":0},"wasteG":{"type":"number","minimum":0,"default":0},"sortOrder":{"type":"integer","minimum":0}},"required":["filamentId","weightG"],"additionalProperties":false},"minItems":1}},"required":["kind","rows"],"additionalProperties":false}]}},"required":["name","complexityTierId","printTimeMin","filamentSource"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"designerId":{"type":"integer","nullable":true},"complexityTierId":{"type":"integer"},"preferredPrinterId":{"type":"integer","nullable":true},"printedBySellerId":{"type":"integer"},"variantLabel":{"type":"string"},"printTimeMin":{"type":"number","minimum":0},"labourMin":{"type":"number","minimum":0},"itemsPerTray":{"type":"integer","exclusiveMinimum":true,"minimum":0},"failureFactorOverride":{"type":"number","nullable":true},"retailOverride":{"type":"number","nullable":true},"wholesaleOverride":{"type":"number","nullable":true},"primaryFilamentId":{"type":"integer","nullable":true},"primaryFilamentEffectiveId":{"type":"integer","nullable":true},"sku":{"type":"string","nullable":true},"imageUrl":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"pushToWoocommerce":{"type":"boolean"},"woocommerceProductId":{"type":"integer","nullable":true},"woocommerceVariationId":{"type":"integer","nullable":true},"woocommerceStatus":{"type":"string","enum":["draft","publish","private"],"nullable":true},"woocommerceSyncedAt":{"type":"string","format":"date-time","nullable":true},"filamentWeightG":{"type":"number","minimum":0},"filamentWasteG":{"type":"number","minimum":0},"hasFilamentBreakdown":{"type":"boolean"},"filaments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"weightG":{"type":"number","minimum":0},"wasteG":{"type":"number","minimum":0},"sortOrder":{"type":"integer","minimum":0},"brand":{"type":"string"},"material":{"type":"string"},"colour":{"type":"string"}},"required":["id","filamentId","weightG","wasteG","sortOrder","brand","material","colour"],"additionalProperties":false}},"pricing":{"type":"object","properties":{"timeCost":{"type":"number"},"filamentCost":{"type":"number"},"filamentCostBreakdown":{"type":"array","items":{"type":"object","properties":{"costPerKg":{"type":"number"},"weightG":{"type":"number"},"wasteG":{"type":"number"},"partCost":{"type":"number"},"wasteCost":{"type":"number"},"totalCost":{"type":"number"}},"required":["costPerKg","weightG","wasteG","partCost","wasteCost","totalCost"],"additionalProperties":false}},"labourCost":{"type":"number"},"totalWasteG":{"type":"number"},"costPerTray":{"type":"number"},"costPerItem":{"type":"number"},"calculatedRetail":{"type":"number"},"effectiveRetail":{"type":"number"},"calculatedWholesale":{"type":"number"},"effectiveWholesale":{"type":"number"},"profitPerItem":{"type":"number"},"profitPerHour":{"type":"number"},"gpMargin":{"type":"number"},"effectiveFailureFactor":{"type":"number"},"retailIsOverridden":{"type":"boolean"},"wholesaleIsOverridden":{"type":"boolean"},"marginShrinkWarning":{"type":"object","properties":{"kind":{"type":"string","enum":["retail-override","wholesale-override"]},"message":{"type":"string"},"costPerItem":{"type":"number"},"overrideValue":{"type":"number"},"marginRemaining":{"type":"number"}},"required":["kind","message","costPerItem","overrideValue","marginRemaining"],"additionalProperties":false,"nullable":true}},"required":["timeCost","filamentCost","filamentCostBreakdown","labourCost","totalWasteG","costPerTray","costPerItem","calculatedRetail","effectiveRetail","calculatedWholesale","effectiveWholesale","profitPerItem","profitPerHour","gpMargin","effectiveFailureFactor","retailIsOverridden","wholesaleIsOverridden","marginShrinkWarning"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","designerId","complexityTierId","preferredPrinterId","printedBySellerId","variantLabel","printTimeMin","labourMin","itemsPerTray","failureFactorOverride","retailOverride","wholesaleOverride","primaryFilamentId","primaryFilamentEffectiveId","sku","imageUrl","isActive","notes","pushToWoocommerce","woocommerceProductId","woocommerceVariationId","woocommerceStatus","woocommerceSyncedAt","filamentWeightG","filamentWasteG","hasFilamentBreakdown","filaments","pricing","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/models/{id}":{"get":{"summary":"Get a model with live pricing","tags":["models"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"designerId":{"type":"integer","nullable":true},"complexityTierId":{"type":"integer"},"preferredPrinterId":{"type":"integer","nullable":true},"printedBySellerId":{"type":"integer"},"variantLabel":{"type":"string"},"printTimeMin":{"type":"number","minimum":0},"labourMin":{"type":"number","minimum":0},"itemsPerTray":{"type":"integer","exclusiveMinimum":true,"minimum":0},"failureFactorOverride":{"type":"number","nullable":true},"retailOverride":{"type":"number","nullable":true},"wholesaleOverride":{"type":"number","nullable":true},"primaryFilamentId":{"type":"integer","nullable":true},"primaryFilamentEffectiveId":{"type":"integer","nullable":true},"sku":{"type":"string","nullable":true},"imageUrl":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"pushToWoocommerce":{"type":"boolean"},"woocommerceProductId":{"type":"integer","nullable":true},"woocommerceVariationId":{"type":"integer","nullable":true},"woocommerceStatus":{"type":"string","enum":["draft","publish","private"],"nullable":true},"woocommerceSyncedAt":{"type":"string","format":"date-time","nullable":true},"filamentWeightG":{"type":"number","minimum":0},"filamentWasteG":{"type":"number","minimum":0},"hasFilamentBreakdown":{"type":"boolean"},"filaments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"weightG":{"type":"number","minimum":0},"wasteG":{"type":"number","minimum":0},"sortOrder":{"type":"integer","minimum":0},"brand":{"type":"string"},"material":{"type":"string"},"colour":{"type":"string"}},"required":["id","filamentId","weightG","wasteG","sortOrder","brand","material","colour"],"additionalProperties":false}},"pricing":{"type":"object","properties":{"timeCost":{"type":"number"},"filamentCost":{"type":"number"},"filamentCostBreakdown":{"type":"array","items":{"type":"object","properties":{"costPerKg":{"type":"number"},"weightG":{"type":"number"},"wasteG":{"type":"number"},"partCost":{"type":"number"},"wasteCost":{"type":"number"},"totalCost":{"type":"number"}},"required":["costPerKg","weightG","wasteG","partCost","wasteCost","totalCost"],"additionalProperties":false}},"labourCost":{"type":"number"},"totalWasteG":{"type":"number"},"costPerTray":{"type":"number"},"costPerItem":{"type":"number"},"calculatedRetail":{"type":"number"},"effectiveRetail":{"type":"number"},"calculatedWholesale":{"type":"number"},"effectiveWholesale":{"type":"number"},"profitPerItem":{"type":"number"},"profitPerHour":{"type":"number"},"gpMargin":{"type":"number"},"effectiveFailureFactor":{"type":"number"},"retailIsOverridden":{"type":"boolean"},"wholesaleIsOverridden":{"type":"boolean"},"marginShrinkWarning":{"type":"object","properties":{"kind":{"type":"string","enum":["retail-override","wholesale-override"]},"message":{"type":"string"},"costPerItem":{"type":"number"},"overrideValue":{"type":"number"},"marginRemaining":{"type":"number"}},"required":["kind","message","costPerItem","overrideValue","marginRemaining"],"additionalProperties":false,"nullable":true}},"required":["timeCost","filamentCost","filamentCostBreakdown","labourCost","totalWasteG","costPerTray","costPerItem","calculatedRetail","effectiveRetail","calculatedWholesale","effectiveWholesale","profitPerItem","profitPerHour","gpMargin","effectiveFailureFactor","retailIsOverridden","wholesaleIsOverridden","marginShrinkWarning"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","designerId","complexityTierId","preferredPrinterId","printedBySellerId","variantLabel","printTimeMin","labourMin","itemsPerTray","failureFactorOverride","retailOverride","wholesaleOverride","primaryFilamentId","primaryFilamentEffectiveId","sku","imageUrl","isActive","notes","pushToWoocommerce","woocommerceProductId","woocommerceVariationId","woocommerceStatus","woocommerceSyncedAt","filamentWeightG","filamentWasteG","hasFilamentBreakdown","filaments","pricing","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update a model. Pass filamentSource to transition between aggregate/detailed; omit to leave filaments untouched.","tags":["models"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"designerId":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"complexityTierId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"preferredPrinterId":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"printedBySellerId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"variantLabel":{"type":"string","maxLength":60},"printTimeMin":{"type":"number","minimum":0},"labourMin":{"type":"number","minimum":0},"itemsPerTray":{"type":"integer","exclusiveMinimum":true,"minimum":0},"failureFactorOverride":{"type":"number","exclusiveMinimum":true,"minimum":0,"nullable":true},"retailOverride":{"type":"number","minimum":0,"nullable":true},"wholesaleOverride":{"type":"number","minimum":0,"nullable":true},"primaryFilamentId":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"sku":{"type":"string","maxLength":50,"nullable":true},"imageUrl":{"type":"string","format":"uri","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","maxLength":2000,"nullable":true},"pushToWoocommerce":{"type":"boolean"},"filamentSource":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["aggregate"]},"weightG":{"type":"number","minimum":0},"wasteG":{"type":"number","minimum":0,"default":0}},"required":["kind","weightG"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["detailed"]},"rows":{"type":"array","items":{"type":"object","properties":{"filamentId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"weightG":{"type":"number","minimum":0},"wasteG":{"type":"number","minimum":0,"default":0},"sortOrder":{"type":"integer","minimum":0}},"required":["filamentId","weightG"],"additionalProperties":false},"minItems":1}},"required":["kind","rows"],"additionalProperties":false}]}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"designerId":{"type":"integer","nullable":true},"complexityTierId":{"type":"integer"},"preferredPrinterId":{"type":"integer","nullable":true},"printedBySellerId":{"type":"integer"},"variantLabel":{"type":"string"},"printTimeMin":{"type":"number","minimum":0},"labourMin":{"type":"number","minimum":0},"itemsPerTray":{"type":"integer","exclusiveMinimum":true,"minimum":0},"failureFactorOverride":{"type":"number","nullable":true},"retailOverride":{"type":"number","nullable":true},"wholesaleOverride":{"type":"number","nullable":true},"primaryFilamentId":{"type":"integer","nullable":true},"primaryFilamentEffectiveId":{"type":"integer","nullable":true},"sku":{"type":"string","nullable":true},"imageUrl":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"pushToWoocommerce":{"type":"boolean"},"woocommerceProductId":{"type":"integer","nullable":true},"woocommerceVariationId":{"type":"integer","nullable":true},"woocommerceStatus":{"type":"string","enum":["draft","publish","private"],"nullable":true},"woocommerceSyncedAt":{"type":"string","format":"date-time","nullable":true},"filamentWeightG":{"type":"number","minimum":0},"filamentWasteG":{"type":"number","minimum":0},"hasFilamentBreakdown":{"type":"boolean"},"filaments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"weightG":{"type":"number","minimum":0},"wasteG":{"type":"number","minimum":0},"sortOrder":{"type":"integer","minimum":0},"brand":{"type":"string"},"material":{"type":"string"},"colour":{"type":"string"}},"required":["id","filamentId","weightG","wasteG","sortOrder","brand","material","colour"],"additionalProperties":false}},"pricing":{"type":"object","properties":{"timeCost":{"type":"number"},"filamentCost":{"type":"number"},"filamentCostBreakdown":{"type":"array","items":{"type":"object","properties":{"costPerKg":{"type":"number"},"weightG":{"type":"number"},"wasteG":{"type":"number"},"partCost":{"type":"number"},"wasteCost":{"type":"number"},"totalCost":{"type":"number"}},"required":["costPerKg","weightG","wasteG","partCost","wasteCost","totalCost"],"additionalProperties":false}},"labourCost":{"type":"number"},"totalWasteG":{"type":"number"},"costPerTray":{"type":"number"},"costPerItem":{"type":"number"},"calculatedRetail":{"type":"number"},"effectiveRetail":{"type":"number"},"calculatedWholesale":{"type":"number"},"effectiveWholesale":{"type":"number"},"profitPerItem":{"type":"number"},"profitPerHour":{"type":"number"},"gpMargin":{"type":"number"},"effectiveFailureFactor":{"type":"number"},"retailIsOverridden":{"type":"boolean"},"wholesaleIsOverridden":{"type":"boolean"},"marginShrinkWarning":{"type":"object","properties":{"kind":{"type":"string","enum":["retail-override","wholesale-override"]},"message":{"type":"string"},"costPerItem":{"type":"number"},"overrideValue":{"type":"number"},"marginRemaining":{"type":"number"}},"required":["kind","message","costPerItem","overrideValue","marginRemaining"],"additionalProperties":false,"nullable":true}},"required":["timeCost","filamentCost","filamentCostBreakdown","labourCost","totalWasteG","costPerTray","costPerItem","calculatedRetail","effectiveRetail","calculatedWholesale","effectiveWholesale","profitPerItem","profitPerHour","gpMargin","effectiveFailureFactor","retailIsOverridden","wholesaleIsOverridden","marginShrinkWarning"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","designerId","complexityTierId","preferredPrinterId","printedBySellerId","variantLabel","printTimeMin","labourMin","itemsPerTray","failureFactorOverride","retailOverride","wholesaleOverride","primaryFilamentId","primaryFilamentEffectiveId","sku","imageUrl","isActive","notes","pushToWoocommerce","woocommerceProductId","woocommerceVariationId","woocommerceStatus","woocommerceSyncedAt","filamentWeightG","filamentWasteG","hasFilamentBreakdown","filaments","pricing","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Soft-delete a model (sets isActive=false)","tags":["models"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/models/import-3mf":{"post":{"summary":"Back-fill a model's print-time, items-per-tray, and (when fully resolvable) per-filament breakdown from a Bambu Studio .3mf file.","tags":["models"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"designerId":{"type":"integer","nullable":true},"complexityTierId":{"type":"integer"},"preferredPrinterId":{"type":"integer","nullable":true},"printedBySellerId":{"type":"integer"},"variantLabel":{"type":"string"},"printTimeMin":{"type":"number","minimum":0},"labourMin":{"type":"number","minimum":0},"itemsPerTray":{"type":"integer","exclusiveMinimum":true,"minimum":0},"failureFactorOverride":{"type":"number","nullable":true},"retailOverride":{"type":"number","nullable":true},"wholesaleOverride":{"type":"number","nullable":true},"primaryFilamentId":{"type":"integer","nullable":true},"primaryFilamentEffectiveId":{"type":"integer","nullable":true},"sku":{"type":"string","nullable":true},"imageUrl":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"pushToWoocommerce":{"type":"boolean"},"woocommerceProductId":{"type":"integer","nullable":true},"woocommerceVariationId":{"type":"integer","nullable":true},"woocommerceStatus":{"type":"string","enum":["draft","publish","private"],"nullable":true},"woocommerceSyncedAt":{"type":"string","format":"date-time","nullable":true},"filamentWeightG":{"type":"number","minimum":0},"filamentWasteG":{"type":"number","minimum":0},"hasFilamentBreakdown":{"type":"boolean"},"filaments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"weightG":{"type":"number","minimum":0},"wasteG":{"type":"number","minimum":0},"sortOrder":{"type":"integer","minimum":0},"brand":{"type":"string"},"material":{"type":"string"},"colour":{"type":"string"}},"required":["id","filamentId","weightG","wasteG","sortOrder","brand","material","colour"],"additionalProperties":false}},"pricing":{"type":"object","properties":{"timeCost":{"type":"number"},"filamentCost":{"type":"number"},"filamentCostBreakdown":{"type":"array","items":{"type":"object","properties":{"costPerKg":{"type":"number"},"weightG":{"type":"number"},"wasteG":{"type":"number"},"partCost":{"type":"number"},"wasteCost":{"type":"number"},"totalCost":{"type":"number"}},"required":["costPerKg","weightG","wasteG","partCost","wasteCost","totalCost"],"additionalProperties":false}},"labourCost":{"type":"number"},"totalWasteG":{"type":"number"},"costPerTray":{"type":"number"},"costPerItem":{"type":"number"},"calculatedRetail":{"type":"number"},"effectiveRetail":{"type":"number"},"calculatedWholesale":{"type":"number"},"effectiveWholesale":{"type":"number"},"profitPerItem":{"type":"number"},"profitPerHour":{"type":"number"},"gpMargin":{"type":"number"},"effectiveFailureFactor":{"type":"number"},"retailIsOverridden":{"type":"boolean"},"wholesaleIsOverridden":{"type":"boolean"},"marginShrinkWarning":{"type":"object","properties":{"kind":{"type":"string","enum":["retail-override","wholesale-override"]},"message":{"type":"string"},"costPerItem":{"type":"number"},"overrideValue":{"type":"number"},"marginRemaining":{"type":"number"}},"required":["kind","message","costPerItem","overrideValue","marginRemaining"],"additionalProperties":false,"nullable":true}},"required":["timeCost","filamentCost","filamentCostBreakdown","labourCost","totalWasteG","costPerTray","costPerItem","calculatedRetail","effectiveRetail","calculatedWholesale","effectiveWholesale","profitPerItem","profitPerHour","gpMargin","effectiveFailureFactor","retailIsOverridden","wholesaleIsOverridden","marginShrinkWarning"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","designerId","complexityTierId","preferredPrinterId","printedBySellerId","variantLabel","printTimeMin","labourMin","itemsPerTray","failureFactorOverride","retailOverride","wholesaleOverride","primaryFilamentId","primaryFilamentEffectiveId","sku","imageUrl","isActive","notes","pushToWoocommerce","woocommerceProductId","woocommerceVariationId","woocommerceStatus","woocommerceSyncedAt","filamentWeightG","filamentWasteG","hasFilamentBreakdown","filaments","pricing","createdAt","updatedAt"],"additionalProperties":false},"meta":{"type":"object","properties":{"sourceFile":{"type":"object","properties":{"name":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0},"sha256":{"type":"string"}},"required":["name","sizeBytes","sha256"],"additionalProperties":false},"plate":{"type":"object","properties":{"plateId":{"type":"integer"},"itemsPerTray":{"type":"integer","minimum":0},"printTimeMin":{"type":"number","nullable":true},"suggestedName":{"type":"string","nullable":true},"bbox":{"type":"object","properties":{"widthMm":{"type":"number","minimum":0},"depthMm":{"type":"number","minimum":0},"heightMm":{"type":"number","minimum":0}},"required":["widthMm","depthMm","heightMm"],"additionalProperties":false,"nullable":true}},"required":["plateId","itemsPerTray","printTimeMin","suggestedName","bbox"],"additionalProperties":false},"filamentSourceUpdated":{"type":"boolean"},"resolvedFilaments":{"type":"array","items":{"type":"object","properties":{"amsSlot":{"type":"integer"},"filamentId":{"type":"integer"},"matchTier":{"type":"string","enum":["exact_hex","auto_linkable","brand_material"]},"colourHexLinked":{"type":"boolean"}},"required":["amsSlot","filamentId","matchTier","colourHexLinked"],"additionalProperties":false}},"unmatchedFilaments":{"type":"array","items":{"type":"object","properties":{"amsSlot":{"type":"integer"},"brand":{"type":"string","nullable":true},"material":{"type":"string","nullable":true},"colour":{"type":"string","nullable":true},"reason":{"type":"string","enum":["missing_brand_or_material","no_match","ambiguous_match"]},"candidates":{"type":"integer","minimum":0}},"required":["amsSlot","brand","material","colour","reason","candidates"],"additionalProperties":false}},"modelMetadata":{"type":"object","properties":{"application":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"designerName":{"type":"string","nullable":true},"designerUserId":{"type":"string","nullable":true},"license":{"type":"string","nullable":true},"copyright":{"type":"string","nullable":true},"creationDate":{"type":"string","nullable":true},"modificationDate":{"type":"string","nullable":true}},"required":["application","title","description","designerName","designerUserId","license","copyright","creationDate","modificationDate"],"additionalProperties":false},"thumbnail":{"type":"object","properties":{"mimeType":{"type":"string","enum":["image/png"]},"bytesBase64":{"type":"string"}},"required":["mimeType","bytesBase64"],"additionalProperties":false,"nullable":true},"warnings":{"type":"array","items":{"type":"string"}}},"required":["sourceFile","plate","filamentSourceUpdated","resolvedFilaments","unmatchedFilaments","modelMetadata","thumbnail","warnings"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"413":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/models/from-3mf":{"post":{"summary":"Update the model catalogue from an uploaded .3mf — create a new model, branch a variant, or rewrite an existing variant's filaments / slicing defaults. No print job recorded.","tags":["models"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"designerId":{"type":"integer","nullable":true},"complexityTierId":{"type":"integer"},"preferredPrinterId":{"type":"integer","nullable":true},"printedBySellerId":{"type":"integer"},"variantLabel":{"type":"string"},"printTimeMin":{"type":"number","minimum":0},"labourMin":{"type":"number","minimum":0},"itemsPerTray":{"type":"integer","exclusiveMinimum":true,"minimum":0},"failureFactorOverride":{"type":"number","nullable":true},"retailOverride":{"type":"number","nullable":true},"wholesaleOverride":{"type":"number","nullable":true},"primaryFilamentId":{"type":"integer","nullable":true},"primaryFilamentEffectiveId":{"type":"integer","nullable":true},"sku":{"type":"string","nullable":true},"imageUrl":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"pushToWoocommerce":{"type":"boolean"},"woocommerceProductId":{"type":"integer","nullable":true},"woocommerceVariationId":{"type":"integer","nullable":true},"woocommerceStatus":{"type":"string","enum":["draft","publish","private"],"nullable":true},"woocommerceSyncedAt":{"type":"string","format":"date-time","nullable":true},"filamentWeightG":{"type":"number","minimum":0},"filamentWasteG":{"type":"number","minimum":0},"hasFilamentBreakdown":{"type":"boolean"},"filaments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"weightG":{"type":"number","minimum":0},"wasteG":{"type":"number","minimum":0},"sortOrder":{"type":"integer","minimum":0},"brand":{"type":"string"},"material":{"type":"string"},"colour":{"type":"string"}},"required":["id","filamentId","weightG","wasteG","sortOrder","brand","material","colour"],"additionalProperties":false}},"pricing":{"type":"object","properties":{"timeCost":{"type":"number"},"filamentCost":{"type":"number"},"filamentCostBreakdown":{"type":"array","items":{"type":"object","properties":{"costPerKg":{"type":"number"},"weightG":{"type":"number"},"wasteG":{"type":"number"},"partCost":{"type":"number"},"wasteCost":{"type":"number"},"totalCost":{"type":"number"}},"required":["costPerKg","weightG","wasteG","partCost","wasteCost","totalCost"],"additionalProperties":false}},"labourCost":{"type":"number"},"totalWasteG":{"type":"number"},"costPerTray":{"type":"number"},"costPerItem":{"type":"number"},"calculatedRetail":{"type":"number"},"effectiveRetail":{"type":"number"},"calculatedWholesale":{"type":"number"},"effectiveWholesale":{"type":"number"},"profitPerItem":{"type":"number"},"profitPerHour":{"type":"number"},"gpMargin":{"type":"number"},"effectiveFailureFactor":{"type":"number"},"retailIsOverridden":{"type":"boolean"},"wholesaleIsOverridden":{"type":"boolean"},"marginShrinkWarning":{"type":"object","properties":{"kind":{"type":"string","enum":["retail-override","wholesale-override"]},"message":{"type":"string"},"costPerItem":{"type":"number"},"overrideValue":{"type":"number"},"marginRemaining":{"type":"number"}},"required":["kind","message","costPerItem","overrideValue","marginRemaining"],"additionalProperties":false,"nullable":true}},"required":["timeCost","filamentCost","filamentCostBreakdown","labourCost","totalWasteG","costPerTray","costPerItem","calculatedRetail","effectiveRetail","calculatedWholesale","effectiveWholesale","profitPerItem","profitPerHour","gpMargin","effectiveFailureFactor","retailIsOverridden","wholesaleIsOverridden","marginShrinkWarning"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","designerId","complexityTierId","preferredPrinterId","printedBySellerId","variantLabel","printTimeMin","labourMin","itemsPerTray","failureFactorOverride","retailOverride","wholesaleOverride","primaryFilamentId","primaryFilamentEffectiveId","sku","imageUrl","isActive","notes","pushToWoocommerce","woocommerceProductId","woocommerceVariationId","woocommerceStatus","woocommerceSyncedAt","filamentWeightG","filamentWasteG","hasFilamentBreakdown","filaments","pricing","createdAt","updatedAt"],"additionalProperties":false},"meta":{"type":"object","properties":{"sourceFile":{"type":"object","properties":{"name":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0},"sha256":{"type":"string"}},"required":["name","sizeBytes","sha256"],"additionalProperties":false},"plate":{"type":"object","properties":{"plateId":{"type":"integer"},"itemsPerTray":{"type":"integer","minimum":0},"printTimeMin":{"type":"number","nullable":true},"suggestedName":{"type":"string","nullable":true}},"required":["plateId","itemsPerTray","printTimeMin","suggestedName"],"additionalProperties":false},"match":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["matched"]},"modelId":{"type":"integer"},"matchedOn":{"type":"string","enum":["explicit_id","exact_key","filament_variant"]}},"required":["kind","modelId","matchedOn"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["created"]},"modelId":{"type":"integer"},"created":{"type":"object","properties":{"name":{"type":"string"},"designerId":{"type":"integer","nullable":true},"variantLabel":{"type":"string"}},"required":["name","designerId","variantLabel"],"additionalProperties":false}},"required":["kind","modelId","created"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["created_variant"]},"modelId":{"type":"integer"},"sourceModelId":{"type":"integer"},"created":{"type":"object","properties":{"name":{"type":"string"},"designerId":{"type":"integer","nullable":true},"variantLabel":{"type":"string"}},"required":["name","designerId","variantLabel"],"additionalProperties":false}},"required":["kind","modelId","sourceModelId","created"],"additionalProperties":false}]},"filamentSourceUpdated":{"type":"boolean"},"slicingDefaultsUpdated":{"type":"boolean"},"warnings":{"type":"array","items":{"type":"string"}}},"required":["sourceFile","plate","match","filamentSourceUpdated","slicingDefaultsUpdated","warnings"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}},"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"designerId":{"type":"integer","nullable":true},"complexityTierId":{"type":"integer"},"preferredPrinterId":{"type":"integer","nullable":true},"printedBySellerId":{"type":"integer"},"variantLabel":{"type":"string"},"printTimeMin":{"type":"number","minimum":0},"labourMin":{"type":"number","minimum":0},"itemsPerTray":{"type":"integer","exclusiveMinimum":true,"minimum":0},"failureFactorOverride":{"type":"number","nullable":true},"retailOverride":{"type":"number","nullable":true},"wholesaleOverride":{"type":"number","nullable":true},"primaryFilamentId":{"type":"integer","nullable":true},"primaryFilamentEffectiveId":{"type":"integer","nullable":true},"sku":{"type":"string","nullable":true},"imageUrl":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"notes":{"type":"string","nullable":true},"pushToWoocommerce":{"type":"boolean"},"woocommerceProductId":{"type":"integer","nullable":true},"woocommerceVariationId":{"type":"integer","nullable":true},"woocommerceStatus":{"type":"string","enum":["draft","publish","private"],"nullable":true},"woocommerceSyncedAt":{"type":"string","format":"date-time","nullable":true},"filamentWeightG":{"type":"number","minimum":0},"filamentWasteG":{"type":"number","minimum":0},"hasFilamentBreakdown":{"type":"boolean"},"filaments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"filamentId":{"type":"integer"},"weightG":{"type":"number","minimum":0},"wasteG":{"type":"number","minimum":0},"sortOrder":{"type":"integer","minimum":0},"brand":{"type":"string"},"material":{"type":"string"},"colour":{"type":"string"}},"required":["id","filamentId","weightG","wasteG","sortOrder","brand","material","colour"],"additionalProperties":false}},"pricing":{"type":"object","properties":{"timeCost":{"type":"number"},"filamentCost":{"type":"number"},"filamentCostBreakdown":{"type":"array","items":{"type":"object","properties":{"costPerKg":{"type":"number"},"weightG":{"type":"number"},"wasteG":{"type":"number"},"partCost":{"type":"number"},"wasteCost":{"type":"number"},"totalCost":{"type":"number"}},"required":["costPerKg","weightG","wasteG","partCost","wasteCost","totalCost"],"additionalProperties":false}},"labourCost":{"type":"number"},"totalWasteG":{"type":"number"},"costPerTray":{"type":"number"},"costPerItem":{"type":"number"},"calculatedRetail":{"type":"number"},"effectiveRetail":{"type":"number"},"calculatedWholesale":{"type":"number"},"effectiveWholesale":{"type":"number"},"profitPerItem":{"type":"number"},"profitPerHour":{"type":"number"},"gpMargin":{"type":"number"},"effectiveFailureFactor":{"type":"number"},"retailIsOverridden":{"type":"boolean"},"wholesaleIsOverridden":{"type":"boolean"},"marginShrinkWarning":{"type":"object","properties":{"kind":{"type":"string","enum":["retail-override","wholesale-override"]},"message":{"type":"string"},"costPerItem":{"type":"number"},"overrideValue":{"type":"number"},"marginRemaining":{"type":"number"}},"required":["kind","message","costPerItem","overrideValue","marginRemaining"],"additionalProperties":false,"nullable":true}},"required":["timeCost","filamentCost","filamentCostBreakdown","labourCost","totalWasteG","costPerTray","costPerItem","calculatedRetail","effectiveRetail","calculatedWholesale","effectiveWholesale","profitPerItem","profitPerHour","gpMargin","effectiveFailureFactor","retailIsOverridden","wholesaleIsOverridden","marginShrinkWarning"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","name","designerId","complexityTierId","preferredPrinterId","printedBySellerId","variantLabel","printTimeMin","labourMin","itemsPerTray","failureFactorOverride","retailOverride","wholesaleOverride","primaryFilamentId","primaryFilamentEffectiveId","sku","imageUrl","isActive","notes","pushToWoocommerce","woocommerceProductId","woocommerceVariationId","woocommerceStatus","woocommerceSyncedAt","filamentWeightG","filamentWasteG","hasFilamentBreakdown","filaments","pricing","createdAt","updatedAt"],"additionalProperties":false},"meta":{"type":"object","properties":{"sourceFile":{"type":"object","properties":{"name":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0},"sha256":{"type":"string"}},"required":["name","sizeBytes","sha256"],"additionalProperties":false},"plate":{"type":"object","properties":{"plateId":{"type":"integer"},"itemsPerTray":{"type":"integer","minimum":0},"printTimeMin":{"type":"number","nullable":true},"suggestedName":{"type":"string","nullable":true}},"required":["plateId","itemsPerTray","printTimeMin","suggestedName"],"additionalProperties":false},"match":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["matched"]},"modelId":{"type":"integer"},"matchedOn":{"type":"string","enum":["explicit_id","exact_key","filament_variant"]}},"required":["kind","modelId","matchedOn"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["created"]},"modelId":{"type":"integer"},"created":{"type":"object","properties":{"name":{"type":"string"},"designerId":{"type":"integer","nullable":true},"variantLabel":{"type":"string"}},"required":["name","designerId","variantLabel"],"additionalProperties":false}},"required":["kind","modelId","created"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["created_variant"]},"modelId":{"type":"integer"},"sourceModelId":{"type":"integer"},"created":{"type":"object","properties":{"name":{"type":"string"},"designerId":{"type":"integer","nullable":true},"variantLabel":{"type":"string"}},"required":["name","designerId","variantLabel"],"additionalProperties":false}},"required":["kind","modelId","sourceModelId","created"],"additionalProperties":false}]},"filamentSourceUpdated":{"type":"boolean"},"slicingDefaultsUpdated":{"type":"boolean"},"warnings":{"type":"array","items":{"type":"string"}}},"required":["sourceFile","plate","match","filamentSourceUpdated","slicingDefaultsUpdated","warnings"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"413":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/print-jobs":{"get":{"summary":"List print jobs (sellers see only their own)","tags":["print-jobs"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"modelId","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"printerId","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"sellerId","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false},{"schema":{"type":"boolean"},"in":"query","name":"failed","required":false},{"schema":{"type":"string","enum":["in_progress","completed","failed","cancelled"]},"in":"query","name":"status","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"modelId":{"type":"integer"},"printerId":{"type":"integer"},"startedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true},"status":{"type":"string","enum":["in_progress","completed","failed","cancelled"]},"itemsAttempted":{"type":"integer","minimum":0},"itemsProduced":{"type":"integer","minimum":0},"completionPercent":{"type":"number","minimum":0,"maximum":100,"nullable":true},"failureCode":{"type":"string","nullable":true},"failureReason":{"type":"string","nullable":true},"failed":{"type":"boolean"},"plannedFilamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"filamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"printedBySellerId":{"type":"integer","nullable":true},"bambuTaskId":{"type":"string","nullable":true},"source3mfSha256":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["id","modelId","printerId","startedAt","completedAt","status","itemsAttempted","itemsProduced","completionPercent","failureCode","failureReason","failed","plannedFilamentDeductions","filamentDeductions","printedBySellerId","bambuTaskId","source3mfSha256","notes"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"post":{"summary":"Record a print job. Inventory bump + filament deduction run atomically at the moment of transition into a terminal status. Pass status='in_progress' to record a print start without side effects (watcher path).","tags":["print-jobs"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"modelId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"printerId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"status":{"type":"string","enum":["in_progress","completed","failed","cancelled"]},"failed":{"type":"boolean"},"itemsAttempted":{"type":"integer","minimum":0},"itemsProduced":{"type":"integer","minimum":0},"completionPercent":{"type":"number","minimum":0,"maximum":100},"failureCode":{"type":"string","minLength":1,"maxLength":200,"pattern":"^[A-Za-z0-9_.:-]+$"},"failureReason":{"type":"string","maxLength":2000},"filamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted"},"spoolsByFilament":{"type":"object","additionalProperties":{"type":"array","items":{"type":"integer","exclusiveMinimum":true,"minimum":0},"minItems":1},"description":"Map of filamentId (as string) → ordered list of spoolIds to drain in sequence"},"printedBySellerId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"bambuTaskId":{"type":"string","minLength":1,"maxLength":200,"pattern":"^[A-Za-z0-9_.:-]+$"},"startedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true},"notes":{"type":"string","maxLength":2000,"nullable":true},"pushToWebsite":{"type":"boolean"},"websiteQty":{"type":"integer","minimum":0}},"required":["modelId","printerId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"modelId":{"type":"integer"},"printerId":{"type":"integer"},"startedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true},"status":{"type":"string","enum":["in_progress","completed","failed","cancelled"]},"itemsAttempted":{"type":"integer","minimum":0},"itemsProduced":{"type":"integer","minimum":0},"completionPercent":{"type":"number","minimum":0,"maximum":100,"nullable":true},"failureCode":{"type":"string","nullable":true},"failureReason":{"type":"string","nullable":true},"failed":{"type":"boolean"},"plannedFilamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"filamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"printedBySellerId":{"type":"integer","nullable":true},"bambuTaskId":{"type":"string","nullable":true},"source3mfSha256":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["id","modelId","printerId","startedAt","completedAt","status","itemsAttempted","itemsProduced","completionPercent","failureCode","failureReason","failed","plannedFilamentDeductions","filamentDeductions","printedBySellerId","bambuTaskId","source3mfSha256","notes"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"modelId":{"type":"integer"},"printerId":{"type":"integer"},"startedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true},"status":{"type":"string","enum":["in_progress","completed","failed","cancelled"]},"itemsAttempted":{"type":"integer","minimum":0},"itemsProduced":{"type":"integer","minimum":0},"completionPercent":{"type":"number","minimum":0,"maximum":100,"nullable":true},"failureCode":{"type":"string","nullable":true},"failureReason":{"type":"string","nullable":true},"failed":{"type":"boolean"},"plannedFilamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"filamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"printedBySellerId":{"type":"integer","nullable":true},"bambuTaskId":{"type":"string","nullable":true},"source3mfSha256":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["id","modelId","printerId","startedAt","completedAt","status","itemsAttempted","itemsProduced","completionPercent","failureCode","failureReason","failed","plannedFilamentDeductions","filamentDeductions","printedBySellerId","bambuTaskId","source3mfSha256","notes"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/print-jobs/{id}":{"get":{"summary":"Get a print job by id (sellers can only fetch their own)","tags":["print-jobs"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"modelId":{"type":"integer"},"printerId":{"type":"integer"},"startedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true},"status":{"type":"string","enum":["in_progress","completed","failed","cancelled"]},"itemsAttempted":{"type":"integer","minimum":0},"itemsProduced":{"type":"integer","minimum":0},"completionPercent":{"type":"number","minimum":0,"maximum":100,"nullable":true},"failureCode":{"type":"string","nullable":true},"failureReason":{"type":"string","nullable":true},"failed":{"type":"boolean"},"plannedFilamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"filamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"printedBySellerId":{"type":"integer","nullable":true},"bambuTaskId":{"type":"string","nullable":true},"source3mfSha256":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["id","modelId","printerId","startedAt","completedAt","status","itemsAttempted","itemsProduced","completionPercent","failureCode","failureReason","failed","plannedFilamentDeductions","filamentDeductions","printedBySellerId","bambuTaskId","source3mfSha256","notes"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update a print job. If `status` is provided, validates the state-machine transition and applies inventory + filament side effects atomically. Soft fields (notes, completedAt) are edited in the same call.","tags":["print-jobs"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["in_progress","completed","failed","cancelled"]},"completionPercent":{"type":"number","minimum":0,"maximum":100},"failureCode":{"type":"string","minLength":1,"maxLength":200,"pattern":"^[A-Za-z0-9_.:-]+$","nullable":true},"failureReason":{"type":"string","maxLength":2000,"nullable":true},"spoolsByFilament":{"type":"object","additionalProperties":{"type":"array","items":{"type":"integer","exclusiveMinimum":true,"minimum":0},"minItems":1},"description":"Map of filamentId (as string) → ordered list of spoolIds to drain in sequence"},"notes":{"type":"string","maxLength":2000,"nullable":true},"completedAt":{"type":"string","format":"date-time","nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"modelId":{"type":"integer"},"printerId":{"type":"integer"},"startedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true},"status":{"type":"string","enum":["in_progress","completed","failed","cancelled"]},"itemsAttempted":{"type":"integer","minimum":0},"itemsProduced":{"type":"integer","minimum":0},"completionPercent":{"type":"number","minimum":0,"maximum":100,"nullable":true},"failureCode":{"type":"string","nullable":true},"failureReason":{"type":"string","nullable":true},"failed":{"type":"boolean"},"plannedFilamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"filamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"printedBySellerId":{"type":"integer","nullable":true},"bambuTaskId":{"type":"string","nullable":true},"source3mfSha256":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["id","modelId","printerId","startedAt","completedAt","status","itemsAttempted","itemsProduced","completionPercent","failureCode","failureReason","failed","plannedFilamentDeductions","filamentDeductions","printedBySellerId","bambuTaskId","source3mfSha256","notes"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/print-jobs/from-3mf":{"post":{"summary":"Record a print job from an uploaded .gcode.3mf. The slicer file IS the source of truth for itemsPerTray, filament burn, and (optionally) which model row this print belongs to.","tags":["print-jobs"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"modelId":{"type":"integer"},"printerId":{"type":"integer"},"startedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true},"status":{"type":"string","enum":["in_progress","completed","failed","cancelled"]},"itemsAttempted":{"type":"integer","minimum":0},"itemsProduced":{"type":"integer","minimum":0},"completionPercent":{"type":"number","minimum":0,"maximum":100,"nullable":true},"failureCode":{"type":"string","nullable":true},"failureReason":{"type":"string","nullable":true},"failed":{"type":"boolean"},"plannedFilamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"filamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"printedBySellerId":{"type":"integer","nullable":true},"bambuTaskId":{"type":"string","nullable":true},"source3mfSha256":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["id","modelId","printerId","startedAt","completedAt","status","itemsAttempted","itemsProduced","completionPercent","failureCode","failureReason","failed","plannedFilamentDeductions","filamentDeductions","printedBySellerId","bambuTaskId","source3mfSha256","notes"],"additionalProperties":false},"meta":{"type":"object","properties":{"sourceFile":{"type":"object","properties":{"name":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0},"sha256":{"type":"string"}},"required":["name","sizeBytes","sha256"],"additionalProperties":false},"plate":{"type":"object","properties":{"plateId":{"type":"integer"},"itemsPerTray":{"type":"integer","minimum":0},"printTimeMin":{"type":"number","nullable":true},"suggestedName":{"type":"string","nullable":true}},"required":["plateId","itemsPerTray","printTimeMin","suggestedName"],"additionalProperties":false},"match":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["matched"]},"modelId":{"type":"integer"},"matchedOn":{"type":"string","enum":["explicit_id","exact_key","filament_variant"]}},"required":["kind","modelId","matchedOn"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["created"]},"modelId":{"type":"integer"},"created":{"type":"object","properties":{"name":{"type":"string"},"designerId":{"type":"integer","nullable":true},"variantLabel":{"type":"string"}},"required":["name","designerId","variantLabel"],"additionalProperties":false}},"required":["kind","modelId","created"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["created_variant"]},"modelId":{"type":"integer"},"sourceModelId":{"type":"integer"},"created":{"type":"object","properties":{"name":{"type":"string"},"designerId":{"type":"integer","nullable":true},"variantLabel":{"type":"string"}},"required":["name","designerId","variantLabel"],"additionalProperties":false}},"required":["kind","modelId","sourceModelId","created"],"additionalProperties":false}]},"warnings":{"type":"array","items":{"type":"string"}}},"required":["sourceFile","plate","match","warnings"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}},"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"modelId":{"type":"integer"},"printerId":{"type":"integer"},"startedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true},"status":{"type":"string","enum":["in_progress","completed","failed","cancelled"]},"itemsAttempted":{"type":"integer","minimum":0},"itemsProduced":{"type":"integer","minimum":0},"completionPercent":{"type":"number","minimum":0,"maximum":100,"nullable":true},"failureCode":{"type":"string","nullable":true},"failureReason":{"type":"string","nullable":true},"failed":{"type":"boolean"},"plannedFilamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"filamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"printedBySellerId":{"type":"integer","nullable":true},"bambuTaskId":{"type":"string","nullable":true},"source3mfSha256":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["id","modelId","printerId","startedAt","completedAt","status","itemsAttempted","itemsProduced","completionPercent","failureCode","failureReason","failed","plannedFilamentDeductions","filamentDeductions","printedBySellerId","bambuTaskId","source3mfSha256","notes"],"additionalProperties":false},"meta":{"type":"object","properties":{"sourceFile":{"type":"object","properties":{"name":{"type":"string"},"sizeBytes":{"type":"integer","minimum":0},"sha256":{"type":"string"}},"required":["name","sizeBytes","sha256"],"additionalProperties":false},"plate":{"type":"object","properties":{"plateId":{"type":"integer"},"itemsPerTray":{"type":"integer","minimum":0},"printTimeMin":{"type":"number","nullable":true},"suggestedName":{"type":"string","nullable":true}},"required":["plateId","itemsPerTray","printTimeMin","suggestedName"],"additionalProperties":false},"match":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["matched"]},"modelId":{"type":"integer"},"matchedOn":{"type":"string","enum":["explicit_id","exact_key","filament_variant"]}},"required":["kind","modelId","matchedOn"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["created"]},"modelId":{"type":"integer"},"created":{"type":"object","properties":{"name":{"type":"string"},"designerId":{"type":"integer","nullable":true},"variantLabel":{"type":"string"}},"required":["name","designerId","variantLabel"],"additionalProperties":false}},"required":["kind","modelId","created"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["created_variant"]},"modelId":{"type":"integer"},"sourceModelId":{"type":"integer"},"created":{"type":"object","properties":{"name":{"type":"string"},"designerId":{"type":"integer","nullable":true},"variantLabel":{"type":"string"}},"required":["name","designerId","variantLabel"],"additionalProperties":false}},"required":["kind","modelId","sourceModelId","created"],"additionalProperties":false}]},"warnings":{"type":"array","items":{"type":"string"}}},"required":["sourceFile","plate","match","warnings"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"413":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/print-jobs/{id}/record-rejection":{"post":{"summary":"Record a post-print quality rejection. Decrements itemsProduced and inventory atomically; filament stays unchanged (material was consumed regardless). Only valid on completed jobs.","tags":["print-jobs"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer","exclusiveMinimum":true,"minimum":0},"reason":{"type":"string","minLength":1,"maxLength":500},"category":{"type":"string","minLength":1,"maxLength":100}},"required":["count","reason"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"rejection":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":true,"minimum":0},"printJobId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"count":{"type":"integer","exclusiveMinimum":true,"minimum":0},"reason":{"type":"string"},"category":{"type":"string","nullable":true},"recordedByUserId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","printJobId","count","reason","category","recordedByUserId","createdAt"],"additionalProperties":false},"printJob":{"type":"object","properties":{"id":{"type":"integer"},"modelId":{"type":"integer"},"printerId":{"type":"integer"},"startedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true},"status":{"type":"string","enum":["in_progress","completed","failed","cancelled"]},"itemsAttempted":{"type":"integer","minimum":0},"itemsProduced":{"type":"integer","minimum":0},"completionPercent":{"type":"number","minimum":0,"maximum":100,"nullable":true},"failureCode":{"type":"string","nullable":true},"failureReason":{"type":"string","nullable":true},"failed":{"type":"boolean"},"plannedFilamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"filamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"printedBySellerId":{"type":"integer","nullable":true},"bambuTaskId":{"type":"string","nullable":true},"source3mfSha256":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["id","modelId","printerId","startedAt","completedAt","status","itemsAttempted","itemsProduced","completionPercent","failureCode","failureReason","failed","plannedFilamentDeductions","filamentDeductions","printedBySellerId","bambuTaskId","source3mfSha256","notes"],"additionalProperties":false}},"required":["rejection","printJob"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/print-jobs/{id}/rejections":{"get":{"summary":"List rejection records for a print job (sellers can only list their own job's rejections).","tags":["print-jobs"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":true,"minimum":0},"printJobId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"count":{"type":"integer","exclusiveMinimum":true,"minimum":0},"reason":{"type":"string"},"category":{"type":"string","nullable":true},"recordedByUserId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","printJobId","count","reason","category","recordedByUserId","createdAt"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/print-jobs/{id}/rejections/{rejectionId}":{"patch":{"summary":"Edit a rejection. Changing count adjusts itemsProduced and inventory by the delta; reason/category edits have no side effects.","tags":["print-jobs"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"count":{"type":"integer","exclusiveMinimum":true,"minimum":0},"reason":{"type":"string","minLength":1,"maxLength":500},"category":{"type":"string","minLength":1,"maxLength":100,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"rejectionId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"rejection":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":true,"minimum":0},"printJobId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"count":{"type":"integer","exclusiveMinimum":true,"minimum":0},"reason":{"type":"string"},"category":{"type":"string","nullable":true},"recordedByUserId":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","printJobId","count","reason","category","recordedByUserId","createdAt"],"additionalProperties":false},"printJob":{"type":"object","properties":{"id":{"type":"integer"},"modelId":{"type":"integer"},"printerId":{"type":"integer"},"startedAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true},"status":{"type":"string","enum":["in_progress","completed","failed","cancelled"]},"itemsAttempted":{"type":"integer","minimum":0},"itemsProduced":{"type":"integer","minimum":0},"completionPercent":{"type":"number","minimum":0,"maximum":100,"nullable":true},"failureCode":{"type":"string","nullable":true},"failureReason":{"type":"string","nullable":true},"failed":{"type":"boolean"},"plannedFilamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"filamentDeductions":{"type":"object","additionalProperties":{"type":"number","minimum":0},"description":"Map of filamentId (as string) → grams deducted","nullable":true},"printedBySellerId":{"type":"integer","nullable":true},"bambuTaskId":{"type":"string","nullable":true},"source3mfSha256":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["id","modelId","printerId","startedAt","completedAt","status","itemsAttempted","itemsProduced","completionPercent","failureCode","failureReason","failed","plannedFilamentDeductions","filamentDeductions","printedBySellerId","bambuTaskId","source3mfSha256","notes"],"additionalProperties":false}},"required":["rejection","printJob"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Undo a rejection. Restores itemsProduced + inventory by the original count and deletes the rejection row.","tags":["print-jobs"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"rejectionId","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/sales":{"get":{"summary":"List sales (sellers see only their own; owners see everything; voided sales excluded by default)","tags":["sales"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"sellerId","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"marketId","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"modelId","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false},{"schema":{"type":"boolean"},"in":"query","name":"includeVoided","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"marketId":{"type":"integer"},"sellerId":{"type":"integer"},"modelId":{"type":"integer"},"printedBySellerId":{"type":"integer"},"qty":{"type":"integer","exclusiveMinimum":true,"minimum":0},"priceEach":{"type":"number"},"paymentMethod":{"type":"string","enum":["square","cash"]},"squareFee":{"type":"number","nullable":true},"costSnapshot":{"type":"number"},"wholesaleSnapshot":{"type":"number"},"retailSnapshot":{"type":"number"},"soldAt":{"type":"string","format":"date-time"},"voidedAt":{"type":"string","format":"date-time","nullable":true},"voidReason":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["id","marketId","sellerId","modelId","printedBySellerId","qty","priceEach","paymentMethod","squareFee","costSnapshot","wholesaleSnapshot","retailSnapshot","soldAt","voidedAt","voidReason","notes"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"post":{"summary":"Record a sale. Sellers can only create sales as themselves; owners can specify any sellerId.","tags":["sales"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"marketId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"sellerId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"modelId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"printedBySellerId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"qty":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"priceEach":{"type":"number","exclusiveMinimum":true,"minimum":0},"paymentMethod":{"type":"string","enum":["square","cash"]},"squareFee":{"type":"number","minimum":0,"nullable":true},"costSnapshot":{"type":"number","minimum":0},"wholesaleSnapshot":{"type":"number","minimum":0},"retailSnapshot":{"type":"number","minimum":0},"soldAt":{"type":"string","format":"date-time"},"notes":{"type":"string","maxLength":2000,"nullable":true}},"required":["marketId","modelId","priceEach","paymentMethod"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"marketId":{"type":"integer"},"sellerId":{"type":"integer"},"modelId":{"type":"integer"},"printedBySellerId":{"type":"integer"},"qty":{"type":"integer","exclusiveMinimum":true,"minimum":0},"priceEach":{"type":"number"},"paymentMethod":{"type":"string","enum":["square","cash"]},"squareFee":{"type":"number","nullable":true},"costSnapshot":{"type":"number"},"wholesaleSnapshot":{"type":"number"},"retailSnapshot":{"type":"number"},"soldAt":{"type":"string","format":"date-time"},"voidedAt":{"type":"string","format":"date-time","nullable":true},"voidReason":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["id","marketId","sellerId","modelId","printedBySellerId","qty","priceEach","paymentMethod","squareFee","costSnapshot","wholesaleSnapshot","retailSnapshot","soldAt","voidedAt","voidReason","notes"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/sales/{id}":{"get":{"summary":"Get a sale by ID (sellers can only access their own sales)","tags":["sales"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"marketId":{"type":"integer"},"sellerId":{"type":"integer"},"modelId":{"type":"integer"},"printedBySellerId":{"type":"integer"},"qty":{"type":"integer","exclusiveMinimum":true,"minimum":0},"priceEach":{"type":"number"},"paymentMethod":{"type":"string","enum":["square","cash"]},"squareFee":{"type":"number","nullable":true},"costSnapshot":{"type":"number"},"wholesaleSnapshot":{"type":"number"},"retailSnapshot":{"type":"number"},"soldAt":{"type":"string","format":"date-time"},"voidedAt":{"type":"string","format":"date-time","nullable":true},"voidReason":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["id","marketId","sellerId","modelId","printedBySellerId","qty","priceEach","paymentMethod","squareFee","costSnapshot","wholesaleSnapshot","retailSnapshot","soldAt","voidedAt","voidReason","notes"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Void a sale (owner-only — soft delete, reverses ledger entries with original effectiveAt, restores inventory)","tags":["sales"],"parameters":[{"schema":{"type":"string","maxLength":500},"in":"query","name":"reason","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/sales/summary":{"get":{"summary":"Aggregate sales totals by seller for a date range (excludes voided sales)","tags":["sales"],"parameters":[{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"sellerId":{"type":"integer"},"count":{"type":"integer"},"totalRevenue":{"type":"number"},"totalCost":{"type":"number"},"totalProfit":{"type":"number"}},"required":["sellerId","count","totalRevenue","totalCost","totalProfit"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}}}}},"/api/v1/stock-transfers":{"get":{"summary":"List stock transfers (sellers see only transfers involving them)","tags":["stock-transfers"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"sellerId","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"modelId","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"fromSellerId":{"type":"integer"},"toSellerId":{"type":"integer"},"modelId":{"type":"integer"},"qty":{"type":"integer","exclusiveMinimum":true,"minimum":0},"transferredAt":{"type":"string","format":"date-time"},"notes":{"type":"string","nullable":true}},"required":["id","fromSellerId","toSellerId","modelId","qty","transferredAt","notes"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"post":{"summary":"Record a stock transfer (owner-only). Both inventories update atomically.","tags":["stock-transfers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fromSellerId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"toSellerId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"modelId":{"type":"integer","exclusiveMinimum":true,"minimum":0},"qty":{"type":"integer","exclusiveMinimum":true,"minimum":0},"transferredAt":{"type":"string","format":"date-time"},"notes":{"type":"string","maxLength":2000,"nullable":true}},"required":["fromSellerId","toSellerId","modelId","qty"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"fromSellerId":{"type":"integer"},"toSellerId":{"type":"integer"},"modelId":{"type":"integer"},"qty":{"type":"integer","exclusiveMinimum":true,"minimum":0},"transferredAt":{"type":"string","format":"date-time"},"notes":{"type":"string","nullable":true}},"required":["id","fromSellerId","toSellerId","modelId","qty","transferredAt","notes"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/stock-transfers/{id}":{"get":{"summary":"Get a stock transfer by id (sellers can only fetch transfers involving them)","tags":["stock-transfers"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"fromSellerId":{"type":"integer"},"toSellerId":{"type":"integer"},"modelId":{"type":"integer"},"qty":{"type":"integer","exclusiveMinimum":true,"minimum":0},"transferredAt":{"type":"string","format":"date-time"},"notes":{"type":"string","nullable":true}},"required":["id","fromSellerId","toSellerId","modelId","qty","transferredAt","notes"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/ledger":{"get":{"summary":"List ledger entries (sellers see only entries involving them)","tags":["ledger"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"sellerId","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"marketId","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false},{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":50},"in":"query","name":"limit","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"saleId":{"type":"integer","nullable":true},"fromSellerId":{"type":"integer"},"toSellerId":{"type":"integer"},"amount":{"type":"number"},"reason":{"type":"string"},"effectiveAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","saleId","fromSellerId","toSellerId","amount","reason","effectiveAt","createdAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}}},"/api/v1/settlements/preview":{"get":{"summary":"Preview the net settlement between two sellers (sellers must be one of the parties)","tags":["settlements"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"sellerA","required":true},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"sellerB","required":true},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":true},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"sellerA":{"type":"integer"},"sellerB":{"type":"integer"},"periodStart":{"type":"string","format":"date-time"},"periodEnd":{"type":"string","format":"date-time"},"totalAtoB":{"type":"number"},"totalBtoA":{"type":"number"},"netAmount":{"type":"number"},"netDirection":{"type":"string","enum":["A_to_B","B_to_A","settled"]},"entryCount":{"type":"integer"}},"required":["sellerA","sellerB","periodStart","periodEnd","totalAtoB","totalBtoA","netAmount","netDirection","entryCount"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/settlements/{id}":{"get":{"summary":"Get a settlement by id (sellers can only fetch settlements they are part of)","tags":["settlements"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"betweenSellerA":{"type":"integer"},"betweenSellerB":{"type":"integer"},"periodStart":{"type":"string","format":"date-time"},"periodEnd":{"type":"string","format":"date-time"},"netAmount":{"type":"number"},"netDirection":{"type":"string"},"paidAt":{"type":"string","format":"date-time","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","betweenSellerA","betweenSellerB","periodStart","periodEnd","netAmount","netDirection","paidAt","notes","createdAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update a settlement (owner-only — typically: mark paid)","tags":["settlements"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"paidAt":{"type":"string","format":"date-time","nullable":true},"notes":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"betweenSellerA":{"type":"integer"},"betweenSellerB":{"type":"integer"},"periodStart":{"type":"string","format":"date-time"},"periodEnd":{"type":"string","format":"date-time"},"netAmount":{"type":"number"},"netDirection":{"type":"string"},"paidAt":{"type":"string","format":"date-time","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","betweenSellerA","betweenSellerB","periodStart","periodEnd","netAmount","netDirection","paidAt","notes","createdAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/settlements":{"get":{"summary":"List recorded settlements (sellers see only their own)","tags":["settlements"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"sellerId","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"betweenSellerA":{"type":"integer"},"betweenSellerB":{"type":"integer"},"periodStart":{"type":"string","format":"date-time"},"periodEnd":{"type":"string","format":"date-time"},"netAmount":{"type":"number"},"netDirection":{"type":"string"},"paidAt":{"type":"string","format":"date-time","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","betweenSellerA","betweenSellerB","periodStart","periodEnd","netAmount","netDirection","paidAt","notes","createdAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"post":{"summary":"Record a settlement (owner-only)","tags":["settlements"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"betweenSellerA":{"type":"integer","exclusiveMinimum":true,"minimum":0},"betweenSellerB":{"type":"integer","exclusiveMinimum":true,"minimum":0},"periodStart":{"type":"string","format":"date-time"},"periodEnd":{"type":"string","format":"date-time"},"paidAt":{"type":"string","format":"date-time","nullable":true},"notes":{"type":"string","maxLength":2000,"nullable":true}},"required":["betweenSellerA","betweenSellerB","periodStart","periodEnd"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"betweenSellerA":{"type":"integer"},"betweenSellerB":{"type":"integer"},"periodStart":{"type":"string","format":"date-time"},"periodEnd":{"type":"string","format":"date-time"},"netAmount":{"type":"number"},"netDirection":{"type":"string"},"paidAt":{"type":"string","format":"date-time","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","betweenSellerA","betweenSellerB","periodStart","periodEnd","netAmount","netDirection","paidAt","notes","createdAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/failure-codes":{"get":{"summary":"List failure codes (any authenticated user). Optionally filter by category or severity.","tags":["failure-codes"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"string","enum":["filament","hardware","thermal","software","user","other"]},"in":"query","name":"category","required":false},{"schema":{"type":"string","enum":["error","warning"]},"in":"query","name":"severity","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"description":{"type":"string"},"category":{"type":"string","enum":["filament","hardware","thermal","software","user","other"]},"severity":{"type":"string","enum":["error","warning"]},"hint":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["code","description","category","severity","hint","createdAt","updatedAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}}}},"post":{"summary":"Create a failure code entry","tags":["failure-codes"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":100},"description":{"type":"string","minLength":1,"maxLength":500},"category":{"type":"string","enum":["filament","hardware","thermal","software","user","other"]},"severity":{"type":"string","enum":["error","warning"]},"hint":{"type":"string","maxLength":500,"nullable":true}},"required":["code","description","category","severity"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"code":{"type":"string"},"description":{"type":"string"},"category":{"type":"string","enum":["filament","hardware","thermal","software","user","other"]},"severity":{"type":"string","enum":["error","warning"]},"hint":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["code","description","category","severity","hint","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/failure-codes/{code}":{"get":{"summary":"Get a failure code by its raw code value","tags":["failure-codes"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100},"in":"path","name":"code","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"code":{"type":"string"},"description":{"type":"string"},"category":{"type":"string","enum":["filament","hardware","thermal","software","user","other"]},"severity":{"type":"string","enum":["error","warning"]},"hint":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["code","description","category","severity","hint","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"summary":"Update a failure code's description, category, severity, or hint","tags":["failure-codes"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":500},"category":{"type":"string","enum":["filament","hardware","thermal","software","user","other"]},"severity":{"type":"string","enum":["error","warning"]},"hint":{"type":"string","maxLength":500,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100},"in":"path","name":"code","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"code":{"type":"string"},"description":{"type":"string"},"category":{"type":"string","enum":["filament","hardware","thermal","software","user","other"]},"severity":{"type":"string","enum":["error","warning"]},"hint":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["code","description","category","severity","hint","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"summary":"Hard-delete a failure code entry","tags":["failure-codes"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":100},"in":"path","name":"code","required":true}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/reports/model-reliability":{"get":{"summary":"Per-model failure and rejection rates over a date window. Sorted worst-first (failure rate desc, then total prints desc).","tags":["reports"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"cursor","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":100,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"modelId","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"modelId":{"type":"integer"},"modelName":{"type":"string"},"totalPrints":{"type":"integer","minimum":0},"printFailures":{"type":"integer","minimum":0},"partialRejections":{"type":"integer","minimum":0},"rejectedItemsTotal":{"type":"integer","minimum":0},"printFailureRate":{"type":"number","minimum":0,"maximum":1},"avgCompletionOnFailure":{"type":"number","minimum":0,"maximum":100,"nullable":true},"totalWastedFilamentG":{"type":"number","minimum":0}},"required":["modelId","modelName","totalPrints","printFailures","partialRejections","rejectedItemsTotal","printFailureRate","avgCompletionOnFailure","totalWastedFilamentG"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"},"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"}},"required":["nextCursor","hasMore","limit","from","to"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/reports/sales-by-period":{"get":{"summary":"Sales totals bucketed by day or month over a date window. Excludes voided sales. Profit = revenue − cost − Square fees.","tags":["reports"],"parameters":[{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false},{"schema":{"type":"string","enum":["day","month"],"default":"month"},"in":"query","name":"bucket","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"marketId","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"sellerId","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"periodStart":{"type":"string"},"units":{"type":"integer","minimum":0},"revenue":{"type":"number"},"cost":{"type":"number"},"fees":{"type":"number"},"profit":{"type":"number"}},"required":["periodStart","units","revenue","cost","fees","profit"],"additionalProperties":false}},"meta":{"type":"object","properties":{"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"},"bucket":{"type":"string","enum":["day","month"]}},"required":["from","to","bucket"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/reports/sales-by-market":{"get":{"summary":"Per-market sales totals over a date window. Ranked by profit desc.","tags":["reports"],"parameters":[{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"marketId":{"type":"integer"},"marketName":{"type":"string"},"units":{"type":"integer","minimum":0},"salesCount":{"type":"integer","minimum":0},"revenue":{"type":"number"},"cost":{"type":"number"},"fees":{"type":"number"},"profit":{"type":"number"},"margin":{"type":"number"}},"required":["marketId","marketName","units","salesCount","revenue","cost","fees","profit","margin"],"additionalProperties":false}},"meta":{"type":"object","properties":{"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"}},"required":["from","to"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/reports/top-models":{"get":{"summary":"Top N models over a date window, ranked by profit / revenue / units.","tags":["reports"],"parameters":[{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false},{"schema":{"type":"string","enum":["profit","revenue","units"],"default":"profit"},"in":"query","name":"metric","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"limit","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"marketId","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"modelId":{"type":"integer"},"modelName":{"type":"string"},"variantLabel":{"type":"string"},"units":{"type":"integer","minimum":0},"revenue":{"type":"number"},"cost":{"type":"number"},"profit":{"type":"number"},"margin":{"type":"number"},"profitPerUnit":{"type":"number"}},"required":["modelId","modelName","variantLabel","units","revenue","cost","profit","margin","profitPerUnit"],"additionalProperties":false}},"meta":{"type":"object","properties":{"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"},"metric":{"type":"string","enum":["profit","revenue","units"]}},"required":["from","to","metric"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/woocommerce/models/{id}/push":{"post":{"summary":"Queue a push of the model's WC family (siblings sharing designer + name). The cron worker processes it within 1–2 minutes.","tags":["woocommerce"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"202":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"enqueued":{"type":"boolean","enum":[true]}},"required":["enqueued"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/woocommerce/models/{id}/sync-stock":{"post":{"summary":"Queue a stock-only update to WC for this model.","tags":["woocommerce"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"202":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"enqueued":{"type":"boolean","enum":[true]}},"required":["enqueued"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/woocommerce/sync-stock":{"post":{"summary":"Queue stock updates for every model that's already linked to WC.","tags":["woocommerce"],"responses":{"202":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"enqueued":{"type":"integer","minimum":0}},"required":["enqueued"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/woocommerce/sync-queue":{"get":{"summary":"List queue entries (most recent first).","tags":["woocommerce"],"parameters":[{"schema":{"type":"string","enum":["pending","in_progress","succeeded","failed"]},"in":"query","name":"status","required":false},{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"query","name":"modelId","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"kind":{"type":"string","enum":["push_product","update_stock"]},"modelId":{"type":"integer"},"status":{"type":"string","enum":["pending","in_progress","succeeded","failed"]},"attempts":{"type":"integer"},"lastError":{"type":"string","nullable":true},"nextAttemptAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","kind","modelId","status","attempts","lastError","nextAttemptAt","createdAt","updatedAt"],"additionalProperties":false}},"meta":{"type":"object","properties":{"nextCursor":{"type":"string","nullable":true},"hasMore":{"type":"boolean"},"limit":{"type":"number"}},"required":["nextCursor","hasMore","limit"],"additionalProperties":false}},"required":["data","meta"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/woocommerce/sync-queue/{id}/retry":{"post":{"summary":"Re-schedule a failed queue entry to run on the next cron tick.","tags":["woocommerce"],"parameters":[{"schema":{"type":"integer","exclusiveMinimum":true,"minimum":0},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"kind":{"type":"string","enum":["push_product","update_stock"]},"modelId":{"type":"integer"},"status":{"type":"string","enum":["pending","in_progress","succeeded","failed"]},"attempts":{"type":"integer"},"lastError":{"type":"string","nullable":true},"nextAttemptAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","kind","modelId","status","attempts","lastError","nextAttemptAt","createdAt","updatedAt"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/health":{"get":{"summary":"Health check (includes DB reachability)","tags":["health"],"security":[],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded"]},"timestamp":{"type":"string","format":"date-time"},"uptime":{"type":"number"},"dbLatencyMs":{"type":"number","nullable":true}},"required":["status","timestamp","uptime","dbLatencyMs"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded"]},"timestamp":{"type":"string","format":"date-time"},"uptime":{"type":"number"},"dbLatencyMs":{"type":"number","nullable":true}},"required":["status","timestamp","uptime","dbLatencyMs"],"additionalProperties":false}}}}}}},"/cron/woocommerce-sync":{"post":{"summary":"Drain pending WooCommerce sync queue entries (Vercel cron caller, bearer-secret auth).","tags":["cron"],"security":[],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"processed":{"type":"integer","minimum":0},"succeeded":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"retryScheduled":{"type":"integer","minimum":0}},"required":["processed","succeeded","failed","retryScheduled"],"additionalProperties":false}},"required":["data"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/openapi.json":{"get":{"responses":{"200":{"description":"Default Response"}}}}},"servers":[{"url":"/"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"health","description":"Health checks"},{"name":"auth","description":"Registration, login, token refresh"},{"name":"global-settings","description":"Per-instance business configuration"},{"name":"printers","description":"Physical 3D printers and their cost rates"},{"name":"complexity-tiers","description":"Print complexity tiers"},{"name":"designers","description":"Model designers"},{"name":"filaments","description":"Filament inventory and costs"},{"name":"inventory","description":"Per-(seller, model) finished-item stock counts + manual adjustments"},{"name":"labour-rates","description":"Per-printer × per-tier labour rates"},{"name":"markets","description":"Venues where sales happen"},{"name":"models","description":"Print models with multi-filament support"},{"name":"print-jobs","description":"Recorded print jobs that bump inventory and burn filament stock"},{"name":"sales","description":"Sales records with profit-split logic"},{"name":"stock-transfers","description":"Move finished-item inventory between sellers"},{"name":"ledger","description":"Inter-seller IOU ledger"},{"name":"settlements","description":"Period-based net-out between sellers"},{"name":"failure-codes","description":"Bambu HMS / printer error codes mapped to human-readable descriptions and categories"},{"name":"reports","description":"Read-only aggregate reports (owner-only)"},{"name":"woocommerce","description":"WooCommerce shop sync (push products + variations, stock updates, queue ops)"},{"name":"cron","description":"Scheduled background workers (Vercel cron, shared-secret auth)"}]}