openapi: 3.0.0
info:
  title: Question Set
  description: APIs for question set
  version: 1.0.0
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

# question set api
paths:
  /api/addquestion:
    post:
      summary: Adds new question to the question set
      description: |
        **Overview**

        *This api is used to add new question in the question set.*

        **Required Fields**

        - question_title
        - question_subtitle
        - question_text
        - question_set_id
        - option_type
        - option1
        - option2
        - option3
        - option4
        - correct_answer

      tags: ["Question"]
      security:
        - BearerAuth: []
      # requestBody:
      #   description: JSON object
      #   required: true
      #   content:
      #     multipart/form-data:
      #       schema:
      #         type: object
      #         properties:
      #           question_title:
      #             type: string
      #             example: What is your city?
      #           question_image:
      #             type: file
      #             example: image.jpg
      #           question_audio:
      #             type: file
      #             example: audio.mp3
      #           question_set_id:
      #             type: number
      #             example: 1
      #           option_type:
      #             type: string
      #             example: text
      #           option1:
      #             type: string
      #             example: option 1
      #           option2:
      #             type: string
      #             example: option 2
      #           option3:
      #             type: string
      #             example: option 3
      #           option4:
      #             type: string
      #             example: option 4
      #         required:
      #           - name
      #           - price
      #           - expiry_duration
      responses:
        "201":
          description: Successful response containing status and message
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Data saved successfully!!!
                required:
                  - status
                  - message
        "400":
          description: Bad request error message
        "401":
          description: Unauthorized error message
        "500":
          description: Internal Server Error

  /api/updatequestion:
    put:
      summary: updates the question of the question set
      description: |
        **Overview**

        *This api is used to update question in the question set.*

        **Required Fields**

        - question_id
        - question_title
        - question_subtitle
        - question_text
        - question_image
        - question_audio
        - option_type
        - option1
        - option2
        - option3
        - option4
        - correct_answer

      tags: ["Question"]
      security:
        - BearerAuth: []
      # requestBody:
      #   description: JSON object
      #   required: true
      #   content:
      #     multipart/form-data:
      #       schema:
      #         type: object
      #         properties:
      #           question_title:
      #             type: string
      #             example: What is your city?
      #           question_image:
      #             type: file
      #             example: image.jpg
      #           question_audio:
      #             type: file
      #             example: audio.mp3
      #           question_set_id:
      #             type: number
      #             example: 1
      #           option_type:
      #             type: string
      #             example: text
      #           option1:
      #             type: string
      #             example: option 1
      #           option2:
      #             type: string
      #             example: option 2
      #           option3:
      #             type: string
      #             example: option 3
      #           option4:
      #             type: string
      #             example: option 4
      #         required:
      #           - name
      #           - price
      #           - expiry_duration
      responses:
        "201":
          description: Successful response containing status and message
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Data updated successfully!!!
                required:
                  - status
                  - message
        "400":
          description: Bad request error message
        "401":
          description: Unauthorized error message
        "500":
          description: Internal Server Error

  /api/question/{question_set_id}:
    get:
      summary: fetches the question of the given question set
      description: >-
        This api fetches the question of the given question set from the database
      tags: ["Question"]
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: question_set_id
          schema:
            type: number
            required: true
            description: question_set_id
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    example: >-
                      true
                  message:
                    type: string
                    example: >-
                      Data found successfully!!!
                  data:
                    type: array
                    example:
                      [
                        {
                          readingQuestions:
                            [
                              {
                                question_id: 8,
                                question_title: What is your city name?,
                                question_subtitle: this is subtitle,
                                question_text: this is text,
                                question_image: 1682670354845--blog.png,
                                question_audio: ,
                                question_set_id: 1,
                                option_id: 9,
                                option_type: audio,
                                option1: 1682670354846--1682330421568--stomping-drums-rhythm-and-percussion-141367.mp3,
                                option2: 1682670354856--Aasma ko chukar dekho_ hanuman returns song_ Movie MAZA.mp3,
                                option3: 1682670354859--1682330421568--stomping-drums-rhythm-and-percussion-141367.mp3,
                                option4: 1682670354867--1682330421568--stomping-drums-rhythm-and-percussion-141367.mp3,
                              },
                            ],
                          listeningQuestions:
                            [
                              {
                                question_id: 1,
                                question_title: What's Your Name?,
                                question_subtitle: this is subtitle,
                                question_text: this is text,                                
                                question_image: 1682337524170--FIGURE 3.PNG,
                                question_audio: 1682337524171--FIGURE 3.PNG,
                                question_set_id: 1,
                                option_id: 1,
                                option_type: text,
                                option1: Prasanna,
                                option2: Amit,
                                option3: Prasanta,
                                option4: Suzan,
                              },
                              {
                                question_id: 2,
                                question_title: What is your city?,
                                question_subtitle: this is subtitle,
                                question_text: this is text,                                
                                question_image: 1682323842010--Screenshot (2).png,
                                question_audio: 1682323842023--Aasma ko chukar dekho_ hanuman returns song_ Movie MAZA.mp3,
                                question_set_id: 1,
                                option_id: 2,
                                option_type: image,
                                option1: 1682323842033--Screenshot (3).png,
                                option2: 1682323842039--Screenshot (4).png,
                                option3: 1682323842041--Screenshot (5).png,
                                option4: 1682323842048--Screenshot (6).png,
                              },
                            ],
                        },
                      ]
                required:
                  - status
                  - message
        "400":
          description: Bad request error message
        "401":
          description: Unauthorized error message
        "500":
          description: Internal Server Error

  /api/getfile/{filename}:
    get:
      summary: gets the file
      description: >-
        This api returns file with the given name
      tags: ["Question"]
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: filename
          schema:
            type: string
            required: true
            description: filename
      responses:
        "200":

        "400":
          description: Bad request error message
        "401":
          description: Unauthorized error message
        "500":
          description: Internal Server Error

  /api/deletequestion/{question_id}:
    delete:
      summary: deletes question  with the given id
      description: >-
        This api deletes question from the question set
      tags: ["Question"]
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: question_id
          schema:
            type: number
            required: true
            description: question_id
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    example: >-
                      true
                  message:
                    type: string
                    example: >-
                      Data deleted successfully!!!
                required:
                  - status
                  - message
        "400":
          description: Bad request error message
        "401":
          description: Unauthorized error message
        "500":
          description: Internal Server Error

  /api/restorequestion/{question_id}:
    put:
      summary: restores the deleted question with the given id
      description: >-
        This api restores the question
      tags: ["Question"]
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: question_id
          schema:
            type: number
            required: true
            description: question_id
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    example: >-
                      true
                  message:
                    type: string
                    example: >-
                      Data updated successfully!!!
                required:
                  - status
                  - message
        "400":
          description: Bad request error message
        "401":
          description: Unauthorized error message
        "500":
          description: Internal Server Error
