{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"url":"https://stock.rossmann-poc.medienwerft.de","description":"Generated server url"}],"tags":[{"name":"Stock Management","description":"APIs for managing product stock and reservations"}],"paths":{"/api/stock/set":{"put":{"tags":["Stock Management"],"summary":"Set stock for a product","description":"Sets current and future stock amounts for a single product","operationId":"setStock","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetStockRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/StockResponse"}}}}}}},"/api/stock/reserve":{"put":{"tags":["Stock Management"],"summary":"Reserve stock for a customer","description":"Attempts to reserve the requested amount of stock for a customer","operationId":"reserveStock","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockReservationRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/StockReservationResponse"}}}}}}},"/api/stock/bulk-set":{"put":{"tags":["Stock Management"],"summary":"Set stock for multiple products","description":"Bulk operation to set current and future stock amounts for multiple products","operationId":"bulkSetStock","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkSetStockRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/StockResponse"}}}}}}}},"/api/stock/probability":{"post":{"tags":["Stock Management"],"summary":"Set purchase probability","description":"Updates the purchase probability for a customer's reservation","operationId":"setPurchaseProbability","parameters":[{"name":"productId","in":"query","required":true,"schema":{"type":"string"}},{"name":"customerId","in":"query","required":true,"schema":{"type":"string"}},{"name":"probability","in":"query","required":true,"schema":{"type":"number","format":"double"}}],"responses":{"200":{"description":"OK"}}}},"/api/stock/claim":{"post":{"tags":["Stock Management"],"summary":"Claim reserved stock","description":"Claims previously reserved stock for a customer","operationId":"claimStock","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StockReservationRequest"}}},"required":true},"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"integer","format":"int32"}}}}}}},"/api/stock/reservations":{"get":{"tags":["Stock Management"],"summary":"Get all current reservations","description":"Returns all current reservations across all products","operationId":"getAllReservations","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/StockReservationResponse"}}}}}}}},"/api/stock/reservations/{productId}":{"get":{"tags":["Stock Management"],"summary":"Get current reservations for a product","description":"Returns all current reservations for a specific product","operationId":"getReservations","parameters":[{"name":"productId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/StockReservationResponse"}}}}}}}},"/api/stock/products":{"get":{"tags":["Stock Management"],"summary":"Get all stock entries","description":"Returns a list of all products with their current stock information and future stocks","operationId":"getAllStocks","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/StockResponse"}}}}}}}},"/api/stock/inquire/{productId}":{"get":{"tags":["Stock Management"],"summary":"Get available stock for a product","description":"Returns the available stock amount after subtracting reservations","operationId":"inquireStock","parameters":[{"name":"productId","in":"path","required":true,"schema":{"type":"string"}},{"name":"date","in":"query","required":false,"schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/StockInquiryResponse"}}}}}}},"/api/stock/get/{productId}":{"get":{"tags":["Stock Management"],"summary":"Get available stock for a product","description":"Returns the available stock amount after subtracting reservations","operationId":"inquireStock_1","parameters":[{"name":"productId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/StockResponse"}}}}}}}},"components":{"schemas":{"FutureStockEntry":{"type":"object","properties":{"date":{"type":"string","format":"date"},"amount":{"type":"integer","format":"int32"}}},"SetStockRequest":{"type":"object","properties":{"productId":{"type":"string"},"currentAmount":{"type":"integer","format":"int32"},"futureStocks":{"type":"array","items":{"$ref":"#/components/schemas/FutureStockEntry"}}}},"StockResponse":{"type":"object","properties":{"productId":{"type":"string"},"currentAmount":{"type":"integer","format":"int32"},"reservedAmount":{"type":"integer","format":"int32"},"availableAmount":{"type":"integer","format":"int32"},"futureStocks":{"type":"array","items":{"$ref":"#/components/schemas/FutureStockEntry"}}}},"StockReservationRequest":{"type":"object","properties":{"productId":{"type":"string"},"customerId":{"type":"string"},"cartId":{"type":"string"},"date":{"type":"string","format":"date"},"amount":{"type":"integer","format":"int32"}}},"StockReservationResponse":{"type":"object","properties":{"productId":{"type":"string"},"customerId":{"type":"string"},"cartId":{"type":"string"},"reservedAmount":{"type":"integer","format":"int32"},"reservedSince":{"type":"string","format":"date-time"},"purchaseProbability":{"type":"number","format":"double"},"reservedSinceTimestamp":{"type":"integer","format":"int64","writeOnly":true}}},"BulkSetStockRequest":{"type":"object","properties":{"stocks":{"type":"array","items":{"$ref":"#/components/schemas/SetStockRequest"}}}},"StockInquiryResponse":{"type":"object","properties":{"productId":{"type":"string"},"date":{"type":"string","format":"date"},"availableAmount":{"type":"integer","format":"int32"}}}}}}