openapi: 3.0.2
paths:

  /app/classes:
    post:
      summary: Create a new class. You need a student or teacher token.
      tags:
        - Class

      security:
        - bearerAuth: []

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

      responses:
        201:
          description: Class created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Class created successfully
                  class:
                    $ref: '#/components/schemas/ClassResponse'

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

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

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

    get:
      summary: Retrieve a list of all classs
      tags:
        - Class

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

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

  /app/classes/{id}:
    get:
      summary: Retrieve a class by ID
      tags:
        - Class

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

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

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

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

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

    put:
      summary: Update a class's information by ID
      tags:
        - Class

      security:
        - bearerAuth: []

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

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

      responses:
        200:
          description: Class updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Class updated successfully
                  class:
                    $ref: '#/components/schemas/ClassResponse'

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

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

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

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

    delete:
      summary: Delete a class by ID
      tags:
        - Class

      security:
        - bearerAuth: []

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

      responses:
        200:
          description: Class deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Class deleted successfully
                  class:
                    $ref: '#/components/schemas/ClassResponse'

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

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

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

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