openapi: 3.0.0
security:
  - BearerAuth: []

components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

tags:
  - name: Cart
    description: API endpoints for managing cart

paths:
  /api/cart:
    post:
      summary: Add an item to the cart
      tags: [Cart]
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                dishId:
                  type: string
                  example: "123e4567-e89b-12d3-a456-426614174000"
                  description: The ID of the dish
                  required: true
                quantity:
                  type: number
                  example: 1
                  description: The quantity of the dish
                  required: true
      responses:
        201:
          description: Item added to cart successfully
        400:
          description: Bad request
        401:
          description: Unauthorized
        404:
          description: Dish not found
        500:
          description: Internal server error

    get:
      summary: Get all cart items
      tags: [Cart]
      security:
        - BearerAuth: []
      responses:
        200:
          description: A list of cart items
        401:
          description: Unauthorized
        500:
          description: Internal server error

  /api/cart/{id}:
    put:
      summary: Update a cart item
      tags: [Cart]
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          description: The ID of the cart item
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                dishId:
                  type: string
                  example: "123e4567-e89b-12d3-a456-426614174000"
                  description: The ID of the dish
                  required: true
                quantity:
                  type: number
                  example: 1
                  description: The quantity of the dish
                  required: true
      responses:
        200:
          description: Cart item updated successfully
        400:
          description: Bad request
        401:
          description: Unauthorized

    delete:
      summary: Delete a cart item
      tags: [Cart]
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          description: The ID of the cart item
      responses:
        200:
          description: Cart item deleted successfully