openapi: 3.0.0
security: 
  - BearerAuth: []

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

tags:
  - name: Faq
    description: API endpoints for managing faq

paths:
  /api/faqs:
    get:
      summary: Get all faqs
      tags: [Faq]
      security:
        - BearerAuth: []
      responses:
        200:
          description: A list of faqs
    post:
      summary: Create a new faq
      tags: [Faq]
      security:
        - BearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                question:
                  type: string
                  example: "Question 1"
                  description: The question of the faq
                  required: true
                answer:
                  type: string
                  example: "Answer 1"
                  description: The answer of the faq
                  required: true
      responses:
        201:   
          description: Faq created successfully
        400:
          description: Bad request
        401:
          description: Unauthorized
        403:
          description: Forbidden

  /api/faqs/{id}:
    put:
      summary: Update a faq
      tags: [Faq]
      security:
        - BearerAuth: [] 
      parameters:
        - name: id
          in: path
          required: true
          description: The ID of the faq
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                question:
                  type: string
                  example: "Question 1"
                  description: The question of the faq
                  required: true
                answer:
                  type: string
                  example: "Answer 1"
                  description: The answer of the faq
                  required: true
      responses:
        200:
          description: Faq updated successfully
        400:
          description: Bad request
        401:
          description: Unauthorized 
        403:
          description: Forbidden
    delete:
      summary: Delete a faq
      tags: [Faq]
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          description: The ID of the faq  
      responses:
        200:
          description: Faq deleted successfully
        400:
          description: Bad request
        401:
          description: Unauthorized
        403:
          description: Forbidden