openapi: 3.0.0
security:
  - BearerAuth: []

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

tags:
  - name: Dishes
    description: API endpoints for managing dishes

paths:  
  /api/dishes:
    get:
      summary: Get all dishes
      tags: [Dishes]
      security:
        - BearerAuth: []
      responses:
        200:
          description: A list of dishes
    post:
      summary: Create a new dish
      tags: [Dishes]
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  example: "Dish 1"
                  description: The name of the dish
                  required: true
                description:
                  type: string
                  example: "Description of the dish"
                  description: The description of the dish
                  required: true
                price:
                  type: number
                  example: 10.00
                  description: The price of the dish
                  required: true
                categoryId:
                  type: string
                  example: "123e4567-e89b-12d3-a456-426614174000"
                  description: The ID of the category
                  required: true
      responses:
        201:
          description: Dish created successfully
        400:
          description: Bad request
        401:
          description: Unauthorized
        403:
          description: Forbidden

  /api/dishes/{id}:
    get:
      summary: Get a dish by ID
      tags: [Dishes]
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path  
          required: true
          description: The ID of the dish
      responses:
        200:
          description: A dish
    put:
      summary: Update a dish by ID    
      tags: [Dishes]
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path  
          required: true
          description: The ID of the dish
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  example: "Dish 1"
                  description: The name of the dish
                  required: true
                description:
                  type: string
                  example: "Description of the dish"
                  description: The description of the dish
                  required: true
                price:
                  type: number
                  example: 10.00
                  description: The price of the dish
                  required: true
                categoryId:
                  type: string
                  example: "123e4567-e89b-12d3-a456-426614174000"
                  description: The ID of the category
                  required: true
      responses:
        200:
          description: Dish updated successfully
        400:
          description: Bad request
        401:
          description: Unauthorized
        403:
          description: Forbidden
        404:
          description: Dish not found
        500:
          description: Internal server error
    delete:
      summary: Delete a dish by ID
      tags: [Dishes]
      parameters:
        - name: id
          in: path  
          required: true
          description: The ID of the dish
      security:
        - BearerAuth: []
      responses:
        200:
          description: Dish deleted successfully
        400:
          description: Bad request
        401:
          description: Unauthorized
        403:
          description: Forbidden
        404:
          description: Dish not found   
        500:
          description: Internal server error

  /api/dishes/{id}/stock:
    patch:
      summary: Update the stock status of a dish by ID
      tags: [Dishes]
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path  
          required: true
          description: The ID of the dish
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                stockStatus:
                  type: boolean
                  example: true
                  description: The stock status of the dish
                  required: true
      responses:
        200:  
          description: Stock status updated successfully
        400:
          description: Bad request
        401:
          description: Unauthorized
        403:
          description: Forbidden
        404:
          description: Dish not found
        500:
          description: Internal server error