openapi: 3.0.2
paths:

  /app/students:
    post:
      summary: Create a new student
      tags:
        - Students

      security:
        - bearerAuth: []

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

      responses:
        201:
          description: Student created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Student created successfully
                  student:
                    $ref: '#/components/schemas/StudentResponse'

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

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

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

    get:
      summary: Retrieve a list of all students
      tags:
        - Students

      security:
        - bearerAuth: []

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

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

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

  /app/students/list-teachers:

    get:
      summary: Find teachers for student
      tags:
        - Students

      security:
        - bearerAuth: []

      parameters:
        - name: days_of_week
          in: query
          description: Filter by available days of week. (Sun = 0; Mon = 1, Wed = 3...)
          required: false
          schema:
            type: array
            items:
              type: number
            example: ["0", "2", "5"]

        - name: start_time
          in: query
          description: Filter by start time in minutes from midnight. (9:00 AM -> 9 * 60 = 540)
          required: false
          schema:
            type: integer
            example: 540

        - name: end_time
          in: query
          description: Filter by end time in minutes from midnight. (5:00 PM -> 17 * 60 = 1020)
          required: false
          schema:
            type: integer
            example: 1020

        - name: discipline_id
          in: query
          description: Filter by discipline ID
          required: false
          schema:
            type: string
            example: "018f22d5-4b3a-7c21-b93f-9a5aefc1b847"

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

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

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

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

  /app/students/{id}:

    get:
      summary: Retrieve a student by ID
      tags:
        - Students

      security:
        - bearerAuth: []

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

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

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

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

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

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

    put:
      summary: Update a student's information by ID
      tags:
        - Students

      security:
        - bearerAuth: []

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

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

      responses:
        200:
          description: Student updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Student updated successfully
                  student:
                    $ref: '#/components/schemas/StudentResponse'

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

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

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

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

    delete:
      summary: Delete a student by ID
      tags:
        - Students

      security:
        - bearerAuth: []

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

      responses:
        200:
          description: Student deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Student deleted successfully
                  student:
                    $ref: '#/components/schemas/StudentResponse'

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

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

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

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