{
  "openapi": "3.1.0",
  "info": {
    "title": "ALWS RESTRO Restaurants API",
    "version": "1.0.0",
    "description": "Menu, online orders and table bookings for restaurant websites connected to ALWS RESTRO. Keys are created by the business owner in ALWS RESTRO (Account Setting → API Keys). Publishable keys (pk_live_) are browser-safe and limited to allowed websites; secret keys (sk_live_) are server-only. Docs: https://developers.alws.in/restaurants/",
    "contact": {
      "name": "ALWS RESTRO",
      "email": "restro@alws.in",
      "url": "https://developers.alws.in/restaurants/"
    }
  },
  "servers": [
    {
      "url": "https://restro.alws.in/api/v1"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "tags": [
    {
      "name": "Menu"
    },
    {
      "name": "Orders"
    },
    {
      "name": "Reservations"
    },
    {
      "name": "Service"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "tags": [
          "Service"
        ],
        "summary": "Service check",
        "security": [],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "ok"
                    },
                    "version": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/restaurant": {
      "get": {
        "tags": [
          "Menu"
        ],
        "summary": "Restaurant details",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Restaurant"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/menu": {
      "get": {
        "tags": [
          "Menu"
        ],
        "summary": "Menu (available items only)",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Menu"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/tables": {
      "get": {
        "tags": [
          "Reservations"
        ],
        "summary": "Floors and tables",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "floors"
                  ],
                  "properties": {
                    "floors": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Floor"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/orders/quote": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Price a cart like the ALWS RESTRO counter",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Cart"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Quote"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/orders": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Place an order",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional, recommended. 8-100 chars [A-Za-z0-9._:-]. Same key on a retry returns the first response instead of creating a duplicate. Remembered 24 hours per API key."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrder"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedOrder"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      },
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "List orders (secret key only)",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/OrderStatus"
            }
          },
          {
            "name": "since",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "hasMore"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Order"
                      }
                    },
                    "hasMore": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/orders/{id}": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Order status",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Order id"
          },
          {
            "name": "X-Order-Token",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Required with a publishable key: the accessToken returned by POST /orders."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/orders/{id}/cancel": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Cancel an order (only while pending or pending_payment)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Order id"
          },
          {
            "name": "X-Order-Token",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Required with a publishable key: the accessToken returned by POST /orders."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/orders/{id}/payment": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Mark an online order as paid (secret key only, after verifying the payment with your gateway)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Order id"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarkPaid"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Order"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/reservations/availability": {
      "get": {
        "tags": [
          "Reservations"
        ],
        "summary": "Free tables for a time slot",
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Availability"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/reservations": {
      "post": {
        "tags": [
          "Reservations"
        ],
        "summary": "Book a table",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional, recommended. 8-100 chars [A-Za-z0-9._:-]. Same key on a retry returns the first response instead of creating a duplicate. Remembered 24 hours per API key."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateReservation"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedReservation"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/E400"
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "422": {
            "$ref": "#/components/responses/E422"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/reservations/{id}": {
      "get": {
        "tags": [
          "Reservations"
        ],
        "summary": "Booking details",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Reservation id"
          },
          {
            "name": "X-Reservation-Token",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Required with a publishable key: the accessToken returned by POST /reservations."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Reservation"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    },
    "/reservations/{id}/cancel": {
      "post": {
        "tags": [
          "Reservations"
        ],
        "summary": "Cancel a booking (before its start time)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Reservation id"
          },
          {
            "name": "X-Reservation-Token",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Required with a publishable key: the accessToken returned by POST /reservations."
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Reservation"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/E401"
          },
          "403": {
            "$ref": "#/components/responses/E403"
          },
          "404": {
            "$ref": "#/components/responses/E404"
          },
          "409": {
            "$ref": "#/components/responses/E409"
          },
          "429": {
            "$ref": "#/components/responses/E429"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "pk_live_… or sk_live_…"
      }
    },
    "responses": {
      "E400": {
        "description": "Invalid request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E401": {
        "description": "Missing, invalid or revoked key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E403": {
        "description": "Not allowed (origin, key type or suspended business)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E404": {
        "description": "Not found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E409": {
        "description": "Conflict (price_changed, cannot_cancel, table_unavailable, idempotency…)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E422": {
        "description": "Unprocessable (item_unavailable, coupon_invalid, slot…)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "E429": {
        "description": "Rate limited; see Retry-After",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "type",
              "code",
              "message",
              "requestId"
            ],
            "properties": {
              "type": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "requestId": {
                "type": "string"
              },
              "details": {
                "type": "object"
              }
            }
          }
        }
      },
      "Restaurant": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "address": {
            "type": "object",
            "properties": {
              "line": {
                "type": "string"
              },
              "city": {
                "type": "string"
              },
              "state": {
                "type": "string"
              }
            }
          },
          "phone": {
            "type": "string"
          },
          "gstin": {
            "type": "string"
          }
        }
      },
      "MenuItem": {
        "type": "object",
        "required": [
          "id",
          "name",
          "price"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "price": {
            "type": "number"
          },
          "foodType": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "veg",
                  "egg",
                  "nonveg"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "specialMenu": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "Menu": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "const": "INR"
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "itemCount": {
                  "type": "integer"
                }
              }
            }
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MenuItem"
            }
          }
        }
      },
      "Floor": {
        "type": "object",
        "properties": {
          "floorId": {
            "type": "string"
          },
          "floorName": {
            "type": "string"
          },
          "tables": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tableId": {
                  "type": "string"
                },
                "tableNumber": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "CartItem": {
        "type": "object",
        "required": [
          "itemId",
          "quantity"
        ],
        "additionalProperties": false,
        "properties": {
          "itemId": {
            "type": "string",
            "maxLength": 64
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 999
          }
        }
      },
      "Cart": {
        "type": "object",
        "required": [
          "items"
        ],
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/CartItem"
            }
          },
          "couponCode": {
            "type": "string",
            "maxLength": 40
          }
        }
      },
      "QuoteLine": {
        "type": "object",
        "properties": {
          "itemId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "foodType": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "unitPrice": {
            "type": "number"
          },
          "quantity": {
            "type": "integer"
          },
          "lineTotal": {
            "type": "number"
          }
        }
      },
      "Quote": {
        "type": "object",
        "properties": {
          "currency": {
            "type": "string",
            "const": "INR"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuoteLine"
            }
          },
          "subtotal": {
            "type": "number"
          },
          "discount": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "couponCode": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "percentage",
                      "flat_per_item"
                    ]
                  },
                  "value": {
                    "type": "number"
                  },
                  "amount": {
                    "type": "number"
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "charges": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "percentage": {
                  "type": "number"
                },
                "amount": {
                  "type": "number"
                }
              }
            }
          },
          "chargesTotal": {
            "type": "number"
          },
          "roundOff": {
            "type": "number"
          },
          "total": {
            "type": "integer",
            "description": "Rounded to the nearest rupee"
          }
        }
      },
      "Customer": {
        "type": "object",
        "required": [
          "name",
          "phone"
        ],
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "phone": {
            "type": "string",
            "pattern": "^\\+?[0-9][0-9 -]{5,18}$"
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 150
          }
        }
      },
      "CreateOrder": {
        "type": "object",
        "required": [
          "items",
          "orderType",
          "customer"
        ],
        "additionalProperties": false,
        "properties": {
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "$ref": "#/components/schemas/CartItem"
            }
          },
          "couponCode": {
            "type": "string",
            "maxLength": 40
          },
          "orderType": {
            "type": "string",
            "enum": [
              "pickup",
              "delivery"
            ]
          },
          "customer": {
            "$ref": "#/components/schemas/Customer"
          },
          "deliveryAddress": {
            "type": "object",
            "required": [
              "line"
            ],
            "additionalProperties": false,
            "description": "Required when orderType is delivery",
            "properties": {
              "line": {
                "type": "string",
                "minLength": 1,
                "maxLength": 300
              },
              "landmark": {
                "type": "string",
                "maxLength": 120
              },
              "city": {
                "type": "string",
                "maxLength": 80
              },
              "pincode": {
                "type": "string",
                "pattern": "^\\d{6}$"
              },
              "location": {
                "type": "object",
                "required": [
                  "lat",
                  "lng"
                ],
                "properties": {
                  "lat": {
                    "type": "number"
                  },
                  "lng": {
                    "type": "number"
                  }
                }
              }
            }
          },
          "scheduledFor": {
            "type": "string",
            "format": "date-time",
            "description": "With offset; future, within 7 days"
          },
          "notes": {
            "type": "string",
            "maxLength": 500
          },
          "payment": {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "cash",
                  "online"
                ],
                "default": "cash"
              }
            }
          },
          "expectedTotal": {
            "type": "number",
            "description": "Total shown to the customer; 409 price_changed if different"
          }
        }
      },
      "OrderStatus": {
        "type": "string",
        "enum": [
          "pending_payment",
          "pending",
          "processing",
          "shipped",
          "delivered",
          "cancelled"
        ]
      },
      "Order": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "orderNumber": {
            "type": "string"
          },
          "status": {
            "$ref": "#/components/schemas/OrderStatus"
          },
          "statusText": {
            "type": "string"
          },
          "paymentStatus": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "paymentMethod": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "orderType": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "pickup",
                  "delivery"
                ]
              },
              {
                "type": "null"
              }
            ]
          },
          "createdAt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "scheduledFor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "itemId": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "name": {
                  "type": "string"
                },
                "category": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "unitPrice": {
                  "type": "number"
                },
                "quantity": {
                  "type": "integer"
                },
                "lineTotal": {
                  "type": "number"
                }
              }
            }
          },
          "subtotal": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "discount": {
            "anyOf": [
              {
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "charges": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "amount": {
                  "type": "number"
                }
              }
            }
          },
          "roundOff": {
            "type": "number"
          },
          "total": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ]
          },
          "customer": {
            "type": "object",
            "properties": {
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "phone": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "email": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "deliveryAddress": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "line": {
                    "type": "string"
                  },
                  "location": {
                    "anyOf": [
                      {
                        "type": "object"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "CreatedOrder": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Order"
          },
          {
            "type": "object",
            "required": [
              "accessToken"
            ],
            "properties": {
              "accessToken": {
                "type": "string",
                "description": "Returned only once"
              }
            }
          }
        ]
      },
      "MarkPaid": {
        "type": "object",
        "required": [
          "provider",
          "reference",
          "amount"
        ],
        "additionalProperties": false,
        "properties": {
          "provider": {
            "type": "string",
            "maxLength": 40
          },
          "reference": {
            "type": "string",
            "maxLength": 100
          },
          "amount": {
            "type": "number",
            "description": "Must equal the order total"
          }
        }
      },
      "Availability": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string"
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "availableCount": {
            "type": "integer"
          },
          "tables": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "tableId": {
                  "type": "string"
                },
                "tableNumber": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "floorId": {
                  "type": "string"
                },
                "floorName": {
                  "type": "string"
                },
                "available": {
                  "type": "boolean"
                }
              }
            }
          }
        }
      },
      "CreateReservation": {
        "type": "object",
        "required": [
          "date",
          "from",
          "to",
          "customer"
        ],
        "additionalProperties": false,
        "properties": {
          "date": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
          },
          "from": {
            "type": "string",
            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
          },
          "to": {
            "type": "string",
            "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
          },
          "tableId": {
            "type": "string",
            "description": "Optional; first free table if omitted"
          },
          "partySize": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100
          },
          "customer": {
            "$ref": "#/components/schemas/Customer"
          },
          "notes": {
            "type": "string",
            "maxLength": 500
          }
        }
      },
      "Reservation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "confirmed",
              "cancelled"
            ]
          },
          "date": {
            "type": "string"
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "table": {
            "type": "object",
            "properties": {
              "tableId": {
                "type": "string"
              },
              "tableNumber": {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "floorId": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "partySize": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ]
          },
          "customer": {
            "type": "object",
            "properties": {
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "phone": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "email": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          },
          "notes": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "CreatedReservation": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Reservation"
          },
          {
            "type": "object",
            "required": [
              "accessToken"
            ],
            "properties": {
              "accessToken": {
                "type": "string",
                "description": "Returned only once"
              }
            }
          }
        ]
      }
    }
  }
}
