openapi: 3.1.0
info:
  title: Api
  version: 0.1.0
  description: API specification for The Astro Lounge
servers:
  - url: /api
    description: Base API path
tags:
  - name: health
    description: Health operations
  - name: menu
    description: Menu operations
  - name: bookings
    description: Booking operations
  - name: contact
    description: Contact operations
paths:
  /healthz:
    get:
      operationId: healthCheck
      tags: [health]
      summary: Health check
      description: Returns server health status
      responses:
        "200":
          description: Healthy
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthStatus"

  /menu:
    get:
      operationId: listMenuItems
      tags: [menu]
      summary: List all menu items
      responses:
        "200":
          description: List of menu items
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/MenuItem"

  /menu/categories:
    get:
      operationId: listMenuCategories
      tags: [menu]
      summary: List all menu categories with item counts
      responses:
        "200":
          description: List of categories
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/MenuCategory"

  /menu/{id}:
    get:
      operationId: getMenuItem
      tags: [menu]
      summary: Get a single menu item
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Menu item
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MenuItem"
        "404":
          description: Not found

  /bookings:
    post:
      operationId: createBooking
      tags: [bookings]
      summary: Submit a booking request (sends email)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BookingInput"
      responses:
        "200":
          description: Booking submitted
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BookingConfirmation"
        "400":
          description: Validation error

  /contact:
    post:
      operationId: submitContact
      tags: [contact]
      summary: Submit a contact message (sends email)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ContactInput"
      responses:
        "200":
          description: Message submitted
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContactConfirmation"
        "400":
          description: Validation error

components:
  schemas:
    HealthStatus:
      type: object
      properties:
        status:
          type: string
      required:
        - status

    MenuItem:
      type: object
      required: [id, name, description, price, category, imageUrl]
      properties:
        id:
          type: integer
        name:
          type: string
        description:
          type: string
        price:
          type: number
        category:
          type: string
        imageUrl:
          type: string
        isPopular:
          type: boolean
        dietaryTags:
          type: array
          items:
            type: string

    MenuCategory:
      type: object
      required: [name, itemCount]
      properties:
        name:
          type: string
        itemCount:
          type: integer
        description:
          type: string

    BookingInput:
      type: object
      required: [name, email, date, time, partySize]
      properties:
        name:
          type: string
          minLength: 1
        email:
          type: string
          format: email
        phone:
          type: string
        date:
          type: string
          description: Date in YYYY-MM-DD format
        time:
          type: string
          description: Time in HH:MM format
        partySize:
          type: integer
          minimum: 1
          maximum: 50
        specialRequests:
          type: string

    BookingConfirmation:
      type: object
      required: [success, message]
      properties:
        success:
          type: boolean
        message:
          type: string

    ContactInput:
      type: object
      required: [name, email, message]
      properties:
        name:
          type: string
          minLength: 1
        email:
          type: string
          format: email
        message:
          type: string
          minLength: 1

    ContactConfirmation:
      type: object
      required: [success, message]
      properties:
        success:
          type: boolean
        message:
          type: string
