openapi: 3.0.2
paths:

  /app/students/classes:
    post:
      summary: Create a new class.
      description: Only students can schedule classes
      tags:
        - Students
        - Class

      security:
        - studentAuthToken: []

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

      responses:
        201:
          description: Class scheduled successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Class scheduled 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 for one Student
      tags:
        - Students
        - Class

      security:
        - studentAuthToken: []

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

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

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

      security:
        - studentAuthToken: []

      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:
        - Students
        - Class

      security:
        - studentAuthToken: []

      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'

  /app/students/classes/{id}/cancel:
    put:
      summary: Cancel a class scheduled by ID
      tags:
        - Students
        - Class

      security:
        - studentAuthToken: []

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

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

      responses:
        200:
          description: Class cancelled successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Class cancelled 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'

  /app/teachers/classes:
    get:
      summary: Retrieve a list of all classs for one Teacher
      tags:
        - Teachers
        - Class

      security:
        - teacherAuthToken: []

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

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

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

      security:
        - teacherAuthToken: []

      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'

  /app/teachers/classes/{id}/finish:
    post:
      summary: Finish a class by ID
      tags:
        - Teachers
        - Class

      security:
        - teacherAuthToken: []

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

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

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

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

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

  /admin/users/classes:

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

      security:
        - userAdminAuthToken: []

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

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

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

      security:
        - userAdminAuthToken: []

      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'