openapi: 3.0.0
security:
  - BearerAuth: []

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

tags:
  - name: Categories
    description: API endpoints for managing categories

paths:
  /api/categories:
    get:
      summary: Get all categories
      tags: [Categories]
      security:
        - BearerAuth: []
      responses:
        200:
          description: A list of categories
    post:
      summary: Create a new category
      tags: [Categories]
      security:
        - BearerAuth: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  example: "Category 1"
                  description: The name of the category
                  required: true
        required: true
      responses:
        201:
          description: Category created successfully
  /api/categories/{id}:
      get:
        summary: Get a category by ID
        tags: [Categories]
        parameters:
          - name: id
            in: path  
            required: true
            description: The ID of the category
        security:
          - BearerAuth: []
        responses:
          200:
            description: A category
      put:
        summary: Update a category by ID
        tags: [Categories]
        security:
          - BearerAuth: []
        parameters:
          - name: id
            in: path
            required: true
            description: The ID of the category
        requestBody:
          required: true
          content:
            application/json:
              schema:
                type: object
                properties:
                  name:
                    type: string
                    example: "Category 1"
                    description: The name of the category
                    required: true   
        responses:
          200:
            description: Category updated successfully
      delete:
        summary: Delete a category by ID
        tags: [Categories]
        security:
          - BearerAuth: []
        parameters:
          - name: id
            in: path
            required: true  
        responses:
          200:
            description: Category deleted successfully  

