{"openapi":"3.1.0","info":{"title":"Expiring Lot Allocation","version":"1.0.0","description":"Allocate an order from eligible lots in expiry order while enforcing minimum remaining shelf life.","contact":{"email":"jeremy@jeremycarter.ca"}},"servers":[{"url":"https://gptenv-x402-catalog.defcronyke.workers.dev"}],"paths":{"/expiring-lot-allocation/v1/check":{"post":{"operationId":"expiring_lot_allocation","summary":"Allocate an order from eligible lots in expiry order while enforcing minimum remaining shelf life.","x-payment-info":{"protocols":[{"x402":{}}],"price":{"mode":"fixed","currency":"USD","amount":"0.04"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"dispatch_day":{"type":"integer","minimum":0,"maximum":100000},"shelf_days":{"type":"integer","minimum":0,"maximum":3650},"quantity":{"type":"integer","exclusiveMinimum":0,"maximum":100000000},"lots":{"maxItems":250,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":60},"expiry_day":{"type":"integer","minimum":0,"maximum":100000},"quantity":{"type":"integer","minimum":0,"maximum":100000000}},"required":["id","expiry_day","quantity"],"additionalProperties":false}}},"required":["dispatch_day","shelf_days","quantity","lots"],"additionalProperties":false},"example":{"dispatch_day":100,"shelf_days":5,"quantity":10,"lots":[{"id":"old","expiry_day":104,"quantity":10},{"id":"early","expiry_day":106,"quantity":3},{"id":"later","expiry_day":112,"quantity":10}]}}}},"responses":{"200":{"description":"Service result","content":{"application/json":{"schema":{"type":"object"},"example":{"pick":[{"id":"early","quantity":3},{"id":"later","quantity":7}],"insufficient_shelf_life":["old"],"shortfall":0}}}},"400":{"description":"Invalid request"},"402":{"description":"x402 exact payment required on Base"},"503":{"description":"Payment unavailable"}}}}}}