openapi: 3.0.2
paths:

  /admin/topics:
    post:
      summary: Create a new topic
      tags:
        - Topics

      security:
        - bearerAuth: []

      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTopic'

      responses:
        201:
          description: Topic created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Topic created successfully
                  topic:
                    $ref: '#/components/schemas/TopicResponse'

        400:
          $ref: '#/components/responses/BadRequest'

        401:
          $ref: '#/components/responses/Unauthorized'

        500:
          $ref: '#/components/responses/InternalServerError'

    get:
      summary: Retrieve a list of all topics
      tags:
        - Topics

      responses:
        200:
          description: A list of topics
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TopicResponse'

        500:
          $ref: '#/components/responses/InternalServerError'

  /admin/topics/{id}:
    get:
      summary: Retrieve a topic by ID
      tags:
        - Topics

      parameters:
        - $ref: '#/components/parameters/IdParameter'

      responses:
        200:
          description: A single topic object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TopicResponse'

        400:
          $ref: '#/components/responses/BadRequest'

        404:
          $ref: '#/components/responses/NotFoundError'

        500:
          $ref: '#/components/responses/InternalServerError'

    put:
      summary: Update a topics's information by ID
      tags:
        - Topics

      security:
        - bearerAuth: []

      parameters:
        - $ref: '#/components/parameters/IdParameter'

      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTopic'

      responses:
        200:
          description: Topic updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Topic updated successfully
                  topic:
                    $ref: '#/components/schemas/TopicResponse'

        400:
          $ref: '#/components/responses/BadRequest'

        401:
          $ref: '#/components/responses/Unauthorized'

        404:
          $ref: '#/components/responses/NotFoundError'

        500:
          $ref: '#/components/responses/InternalServerError'

    delete:
      summary: Delete a topic by ID
      tags:
        - Topics

      security:
        - bearerAuth: []

      parameters:
        - $ref: '#/components/parameters/IdParameter'

      responses:
        200:
          description: Topic deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Topic deleted successfully
                  topic:
                    $ref: '#/components/schemas/TopicResponse'

        400:
          $ref: '#/components/responses/BadRequest'

        401:
          $ref: '#/components/responses/Unauthorized'

        404:
          $ref: '#/components/responses/NotFoundError'

        500:
          $ref: '#/components/responses/InternalServerError'
