{
  "openapi": "3.1.0",
  "info": {
    "title": "Leaven House ordering API (concept demo)",
    "version": "0.1.0",
    "description": "Order ahead for pickup at Leaven House, a from-scratch bakery café at 297 Dundas St E, Waterdown, Ontario. Concept demo by ShiftLogic: orders are held in memory and are not sent to the bakery."
  },
  "servers": [{ "url": "/" }],
  "paths": {
    "/api/menu": {
      "get": { "operationId": "getMenu", "summary": "Menu items, sizes, prices (CAD) and opening hours", "responses": { "200": { "description": "Menu", "content": { "application/json": { "schema": { "type": "object" } } } } } }
    },
    "/api/pickup-times": {
      "get": {
        "operationId": "getPickupTimes", "summary": "Open 15-minute pickup slots for a date (America/Toronto). Closed Tuesdays.",
        "parameters": [{ "name": "date", "in": "query", "required": true, "schema": { "type": "string", "format": "date" } }],
        "responses": { "200": { "description": "Slots", "content": { "application/json": { "schema": { "type": "object", "properties": { "date": { "type": "string" }, "open": { "type": "boolean" }, "slots": { "type": "array", "items": { "type": "string", "example": "10:00" } } } } } } } }
      }
    },
    "/api/orders": {
      "post": {
        "operationId": "placeOrder", "summary": "Place a pickup order, a pie pre-order or a cake quote request. Payment is in store.",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Order" } } } },
        "responses": {
          "201": { "description": "Confirmed", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean" }, "code": { "type": "string", "example": "LH-4821" }, "total": { "type": "number" }, "message": { "type": "string" } } } } } },
          "422": { "description": "Rejected, with a reason an assistant can act on", "content": { "application/json": { "schema": { "type": "object", "properties": { "ok": { "type": "boolean" }, "error": { "type": "string" } } } } } }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Order": {
        "type": "object", "required": ["name"],
        "properties": {
          "type": { "type": "string", "enum": ["pickup", "pie", "cake-quote"], "default": "pickup" },
          "items": { "type": "array", "items": { "type": "object", "required": ["id", "qty"], "properties": { "id": { "type": "string", "example": "cupcake" }, "size": { "type": "string", "enum": ["sm", "med", "lrg", "single", "double"] }, "qty": { "type": "integer", "minimum": 1, "maximum": 48 } } } },
          "pickup": { "type": "object", "properties": { "date": { "type": "string", "format": "date" }, "time": { "type": "string", "example": "10:00" } } },
          "name": { "type": "string" }, "phone": { "type": "string" }, "notes": { "type": "string" },
          "occasion": { "type": "string" }, "date": { "type": "string", "format": "date" }, "servings": { "type": "string" }, "details": { "type": "string" }, "contact": { "type": "string" }
        }
      }
    }
  }
}
