openapi: 3.0.0
info:
  title: Mobile App
  description: APIs for Mobile App
  version: 1.0.0
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

# question set api
paths:
  /api/user/getquestionset:
    get:
      summary: Returns the list of question set
      description: >-
        This api fetches the list of question set from the database
      tags: ["Mobile App"]
      security:
        - BearerAuth: []
      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:
                      [
                        {
                          question_set_id: 1,
                          name: Set A,
                          price: 250,
                          expiry_duration: 3h,
                          score: 32,
                          payment_status: 0,
                        },
                        {
                          question_set_id: 2,
                          name: Set B,
                          price: 350,
                          expiry_duration: 3h,
                          score: "-",
                          payment_status: 0,
                        },
                      ]
                required:
                  - status
                  - message
                  - data
        "400":
          description: Bad request error message
        "401":
          description: Unauthorized error message
        "500":
          description: Internal Server Error
  /api/user/getquestionset/{package_id}:
    get:
      summary: Returns the list of question set
      description: >-
        This api fetches the list of question set from the database
      tags: ["Mobile App"]
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: package_id
          schema:
            type: number
            required: true
            description: package_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:
                      [
                        {
                          question_set_id: 1,
                          name: Set A,
                          price: 250,
                          expiry_duration: 3h,
                          score: 32,
                          payment_status: 0,
                        },
                        {
                          question_set_id: 2,
                          name: Set B,
                          price: 350,
                          expiry_duration: 3h,
                          score: "-",
                          payment_status: 0,
                        },
                      ]
                required:
                  - status
                  - message
                  - data
        "400":
          description: Bad request error message
        "401":
          description: Unauthorized error message
        "500":
          description: Internal Server Error
  /api/user/getquestionsetpackage:
    get:
      summary: Returns the list of question set package
      description: >-
        This api fetches the list of question set package from the database
      tags: ["Mobile App"]
      security:
        - BearerAuth: []
      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:
                      [
                        {
                          package_id: 1,
                          package_name: Set A,
                          question_set_id: [2, 4, 6, 8, 9, 10],
                          price: 250,
                        },
                        {
                          package_id: 1,
                          package_name: Set A,
                          question_set_id: [2, 4, 6, 8, 9, 10],
                          price: 250,
                        },
                      ]
                required:
                  - status
                  - message
                  - data
        "400":
          description: Bad request error message
        "401":
          description: Unauthorized error message
        "500":
          description: Internal Server Error
  /api/user/getquestion/{questionSetId}:
    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: ["Mobile App"]
      security:
        - BearerAuth: []
      parameters:
        - in: path
          name: questionSetId
          schema:
            type: number
            required: true
            description: questionSetId
      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_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_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_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/user/savescore:
    post:
      summary: saves the submitted answer and calculates score
      description: |
        **Overview**

        *This api is used to save the answer submitted by the user and calculates the score

        **Required Fields**

        - question_set_id
        - review ***[review is array type that consists of objects containing two properties: question_id and submitted_answer]***

      tags: ["Mobile App"]
      security:
        - BearerAuth: []
      requestBody:
        description: JSON object
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                question_set_id:
                  type: number
                  example: 1
                review:
                  type: array
                  example:
                    [
                      { question_id: 1, submitted_answer: "option1" },
                      { question_id: 2, submitted_answer: "option2" },
                    ]
              required:
                - question_set_id
                - review
      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!!!
                  correct_answer:
                    type: number
                    example: 18
                required:
                  - status
                  - message
                  - correct_answer
        "400":
          description: Bad request error message
        "401":
          description: Unauthorized error message
        "500":
          description: Internal Server Error

  /api/user/profile:
    get:
      summary: Returns the profile of user
      description: >-
        This api fetches the user profile details
      tags: ["Mobile App"]
      security:
        - BearerAuth: []
      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:
                      [
                        {
                          user_id: 2,
                          name: Set B,
                          email: "user@gmail.com",
                          address: "Nayamill",
                          image: "something.png",
                          created_at: "2023-05-09T09:19:18.000Z",
                          updated_at: "2023-05-09T09:19:18.000Z",
                          contact: "984893232",
                          user_type: user,
                        },
                      ]
                required:
                  - status
                  - message
                  - data
        "400":
          description: Bad request error message
        "401":
          description: Unauthorized error message
        "500":
          description: Internal Server Error

    /api/user/savescore:
    put:
      summary: updates user profile
      description: |
        **Overview**

        *This api is used to update profile details by the user

        **Required Fields**

        - name
        - contact
        - address
        - image ***[image can be new file image or previous file path if exists ]***

      tags: ["Mobile App"]
      security:
        - BearerAuth: []

      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/user/review/{question_set_id}:
    get:
      summary: Returns the list of questions with submitted answer and correct_answer submitted by the user
      description: >-
        This api fetches the list of questions with submitted answer and correct_answer submitted by the user
      tags: ["Mobile App"]
      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:
                      [
                        {
                          question_id: 1,
                          question_title: What's Your Name?,
                          question_subtitle: guess the correct option,
                          question_text: the options are as follows,
                          question_image,
                          question_audio,
                          option1: Prasanna,
                          option2: Amit,
                          option3: Prasanta,
                          option4: Suzan,
                          correct_answer: option1,
                          submitted_answer: option2,
                        },
                        {
                          question_id: 2,
                          question_title: What's Your Name?,
                          question_subtitle: guess the correct option,
                          question_text: the options are as follows,
                          question_image,
                          question_audio,
                          option1: Prasanna,
                          option2: Amit,
                          option3: Prasanta,
                          option4: Suzan,
                          correct_answer: option1,
                          submitted_answer: option2,
                        },
                      ]
                required:
                  - status
                  - message
                  - data
        "400":
          description: Bad request error message
        "401":
          description: Unauthorized error message
        "500":
          description: Internal Server Error

  /api/user/getbooklist:
    get:
      summary: Returns the list of available book
      description: >-
        This api fetches the list of available book
      tags: ["Mobile App"]
      security:
        - BearerAuth: []
      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:
                      [
                        {
                         book_name: "1685339065732--Authentication and Authorization.pdf"
                        },
                        {
                         "book_name": "1685339065732--Authentication and Authorization.pdf"
                        },
                      ]
                  total:
                    type: number,
                    example: 8
                required:
                  - status
                  - message
                  - data
                  - total
        "400":
          description: Bad request error message
        "401":
          description: Unauthorized error message
        "500":
          description: Internal Server Error

  /api/user/getaudiobooklist:
    get:
      summary: Returns the list of audio books
      description: >-
        This api fetches the list of audio books from the database
      tags: ["Mobile App"]
      security:
        - BearerAuth: []
      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:
                      [
                        {
                          "book_id": 3,
                          "book_name": "test_audio_book",
                          "file_name": "1692166173579--Copy of Audio 6 (1_350).mp3",
                        },
                      ]
                required:
                  - status
                  - message
                  - data
        "400":
          description: Bad request error message
        "401":
          description: Unauthorized error message
        "500":
          description: Internal Server Error