openapi: "3.0.2"
info:
  title: API Title
  version: "1.0"
servers:
  - url: https://api.server.test/v1

components:
  securitySchemes:
    bearerAuth: 
      description: "#### Example: Bearer [TOKEN]"
      type: http
      scheme: bearer
      bearerFormat: JWT
  responses:
    successResponse:
      description: Success
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: boolean
                example: false
              message:
                type: string
                example: success message
              statusCode:
                type: integer
                example: 200
              messageCode:
                type: string
                example: LOGIN_SUCCESS
              data:
                type: string
                example:

    errorResponse:
      description: Error
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: boolean
                example: true
              statusCode:
                type: integer
                example: 422
              message:
                type: string
                example: idToken is not allowed to be empty

paths:
  /v1/users/register:
    post:
      summary: Register
      description: "- Email register pass only email not phone number
        - phone number register pass only phone not email"
      tags:
        - Auth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                firstName:
                  type: string
                  example: John
                lastName:
                  type: string
                  example: Snow
                email:
                  type: string
                  example: john.snow@mailinator.com
                phoneNumber:
                  type: string
                  example: "+91 9558688745"
                password:
                  type: string
                  example: password
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"

  /v1/users/register/resend-otp:
    post:
      summary: register resend otp
      description: ""
      tags:
        - Auth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  example: john.snow@mailinator.com
                phoneNumber:
                  type: string
                  example: "+91 9558688745"
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"

  /v1/users/verify:
    post:
      summary: Verify user
      description: "- Email register pass only email not phone number
        - phone number register pass only phone not email"
      tags:
        - Auth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  example: john.snow@mailinator.com
                phoneNumber:
                  type: string
                  example: "+91 9558688745"
                otp:
                  type: number
                  example: 1234
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"
  
  /v1/users/login:
    post:
      summary: Login user
      description: "- Email  = pass email or phone number"
      tags:
        - Auth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  example: john.snow@mailinator.com
                password:
                  type: string
                  example: password
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"
  
  /v1/users/social-login:
    post:
      summary: "Social login"
      description: "- providerType should be in [google,apple]
        - <b>pass idToken for google/apple login</b> => token"
      tags:
        - Auth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                providerType:
                  type: string
                  example: google
                token:
                  type: string
                  example: "eyJraWQiOiJZdXlYb1kiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczovL2FwcGxlaWQuYXBwbGUuY29tIiwiYXVkIjoiY29tLnNwYXJrLm1vYmlsZS5hcHAiLCJleHAiOjE2MTQ0MDY5NDQsImlhdCI6MTYxNDMyMDU0NCwic3ViIjoiMDAxMzQzLmZmNDVmYTBiMTk4MjQ3YTJhZmJhYmU1M2ExNzE3NWJlLjA0MzIiLCJjX2hhc2giOiJzZGZSSVFhSzZjdFhUUXlPUGxlMjFRIiwiZW1haWwiOiI5Z3p4dmN0bmFzQHByaXZhdGVyZWxheS5hcHBsZWlkLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjoidHJ1ZSIsImlzX3ByaXZhdGVfZW1haWwiOiJ0cnVlIiwiYXV0aF90aW1lIjoxNjE0MzIwNTQ0LCJub25jZV9zdXBwb3J0ZWQiOnRydWUsInJlYWxfdXNlcl9zdGF0dXMiOjJ9.h0JasGlJuj8HQFgQgeEm-9Kiyfu1o8BP1y5EWF5hByJMTCMhzzdvEC1hW3LW5_-cIz29IRJPD7DKWpvb3MhP6oC0Y08HYjyIKgJ__RR5JizZ6sq34Xngrv44yRRFrbws7yqsYo7ADWIjG2CZyTasOWzXa2m67bYTv0xTB75fk3HCBCtlujbmRy7OxNXolkeKVJgvLi6y9xd57ghwZ2fwmCyEr3A6YDrRbMTc1_-o22jzXOyFQgXZfsV8Wp2E8ifPyOqmWrtrlDt90OX9bSLDZv28ey2BGKp3qSZp9nKEwtDylrD7-Yu5-hLvCY-UxHODhuGJmCxIhg0T4VwCaj0kzA"
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"
  
  /v1/users/logout:
    get:
      summary: Logout user
      description: ""
      tags:
        - Auth
      security:
        - bearerAuth: []
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"
  
  /v1/forgot-password/send-otp:
    post:
      summary: Forgot password
      description: "- Email  = pass email or phone number"
      tags:
        - Forgot Password
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  example: john.snow@mailinator.com
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"
  
  /v1/forgot-password/verify-otp:
    post:
      summary: Verify otp
      description: "- Email  = pass email or phone number"
      tags:
        - Forgot Password
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  example: john.snow@mailinator.com
                otp:
                  type: number
                  example: 1234
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"
  
  /v1/forgot-password/save-password:
    post:
      summary: Save password
      description: "- Email  = pass email or phone number"
      tags:
        - Forgot Password
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  example: john.snow@mailinator.com
                otp:
                  type: number
                  example: 1234
                password:
                  type: string
                  example: password
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"
  
  /v1/users/{userId}:
    get:
      summary: details
      description: ""
      tags:
        - User
      security:
        - bearerAuth: []
      parameters:
        - in: path
          name: userId
          schema:
            type: string
            example: 1
          required: true
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"

    put:
      summary: update
      description: ""
      tags:
        - User
      security:
        - bearerAuth: []
      parameters:
        - in: path
          name: userId
          schema:
            type: string
            example: 1
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                firstName:
                  type: string
                  example: John
                lastName:
                  type: string
                  example: Snow
                aboutMe:
                  type: string
                  example: Amet minim mollit non deserunt ullamco est sit aliqua dolor do amet sint. Velit officia consequat duis enim velit mollit. Exercitation veniam consequat sunt nostrud amet.
                dateOfBirth:
                  type: string
                  example: "1992-06-12"
                gender:
                  type: string
                  example: Male
                sexualOrientation:
                  type: string
                  example: Heterosexual
                genderPreference:
                  type: string
                  example: Female
                schoolName:
                  type: string
                  example: Female
                interests:
                  type: string
                  example: [1,2]
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"
  
    delete:
      summary: delete
      description: ""
      tags:
        - User
      security:
        - bearerAuth: []
      parameters:
        - in: path
          name: userId
          schema:
            type: string
            example: 1
          required: true
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"      
  
  /v1/users/change-password:
    post:
      summary: "Change password"
      description: ""
      tags:
        - User
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                oldPassword:
                  type: string
                  example: password
                newPassword:
                  type: string
                  example: "Password@123"
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"
  
  /v1/users:
    get:
      summary: user list
      description: "- for pagination pass limit, page"
      tags:
        - User
      security:
        - bearerAuth: []
      parameters:
        - in: "query"
          name: "limit"
          schema:
            type: "integer"
            example: "10"
        - in: "query"
          name: "page"
          schema:
            type: "integer"
            example: "1"
        - in: "query"
          name: "isOnline"
          schema:
            type: "integer"
            enum:
              - 1
              - 0
        - in: "query"
          name: "gender"
          schema:
            type: "string"
        - in: "query"
          name: "minAge"
          schema:
            type: "integer"
        - in: "query"
          name: "maxAge"
          schema:
            type: "integer"
        - in: "query"
          name: "sortBy"
          schema:
            type: "string"
            example: closest_to_me
            enum:
              - closestToMe
              - youngestToOldest
              - oldestToYoungest
        - in: "query"
          name: "latitude"
          schema:
            type: "number"
            example: 21.1702
          required: true
        - in: "query"
          name: "longitude"
          schema:
            type: "number"
            example: 72.8311
          required: true
        - in: "query"
          name: "search"
          schema:
            type: "string"
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"
  
  /v1/categories:
    get:
      summary: list
      description: ""
      tags:
        - Category
      security:
        - bearerAuth: []
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"
  
  /v1/interests:
    get:
      summary: list
      description: ""
      tags:
        - Interest
      security:
        - bearerAuth: []
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"

  /v1/user-photos:
    get:
      summary: photos
      description: ""
      tags:
        - Photos
      security:
        - bearerAuth: []
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"

    post:
      summary: Upload photos
      description: ""
      tags:
        - Photos
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                photos:
                  type: array
                  items:
                    type: string
                    format: binary
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"

  /v1/user-photos/move:
    post:
      summary: update position
      description: ""
      tags:
        - Photos
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                photos:
                  type: array
                  items:
                    type: object
                    properties:
                      userPhotoId:
                        type: number
                        example: 1
                      position:
                        type: number
                        example: 1
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"

  /v1/user-photos/{userPhotoId}:
    delete:
      summary: delete photo
      description: ""
      tags:
        - Photos
      security:
        - bearerAuth: []
      parameters:
        - in: path
          name: userPhotoId
          schema:
            type: string
            example: 1
          required: true
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"

  /v1/chats:
    get:
      summary: chat list
      description: "
       - messageType: text,video,image,audio"
      tags:
        - Chat
      security:
        - bearerAuth: []
      parameters:
        - in: "query"
          name: "limit"
          schema:
            type: "integer"
            example: "10"
        - in: "query"
          name: "page"
          schema:
            type: "integer"
            example: "1"
        - in: "query"
          name: "status"
          schema:
            type: "string"
            enum:
              - pending
              - approved
        - in: "query"
          name: "search"
          schema:
            type: "string"
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"

  /v1/chats/{userId}:
    get:
      summary: message list
      description: "
       - messageType: text,video,image,audio"
      tags:
        - Chat
      security:
        - bearerAuth: []
      parameters:
        - in: "path"
          name: "userId"
          schema:
            type: "integer"
            example: "19"
          required: true
        - in: "query"
          name: "limit"
          schema:
            type: "integer"
            example: "10"
        - in: "query"
          name: "page"
          schema:
            type: "integer"
            example: "1"
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"

    delete:
      summary: Delete chat
      description: "
       - messageType: text,video,image,audio"
      tags:
        - Chat
      security:
        - bearerAuth: []
      parameters:
        - in: "path"
          name: "userId"
          schema:
            type: "integer"
            example: "19"
          required: true
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"      
  
  /v1/chats/upload:
    post:
      summary: Upload media
      description: ""
      tags:
        - Chat
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                media:
                  type: string
                  format: binary
                thumbnail:
                  type: string
                  format: binary
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"

  /v1/chats/status:
    post:
      summary: Update chat status
      description: ""
      tags:
        - Chat
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                senderId:
                  type: number
                  example: 1
                receiverId:
                  type: number
                  example: 1
                status:
                  type: string
                  enum:
                    - approved
                    - rejected
                  example: approved
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"
  
  /v1/block-users:
    get:
      summary: block user list
      description: ""
      tags:
        - Block User
      security:
        - bearerAuth: []
      parameters:
        - in: "query"
          name: "limit"
          schema:
            type: "integer"
            example: "10"
        - in: "query"
          name: "page"
          schema:
            type: "integer"
            example: "1"
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"
  
  /v1/block-users/{UserId}:
    get:
      summary: block / unblock user
      description: ""
      tags:
        - Block User
      security:
        - bearerAuth: []
      parameters:
        - in: "path"
          name: "UserId"
          description: "pass block user id"
          schema:
            type: "integer"
            example: "19"
          required: true
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"

  /v1/report-users:
    post:
      summary: Report user
      description: ""
      tags:
        - Report User
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                userId:
                  type: number
                  example: 1
                reason:
                  type: string
                  enum:
                    - Suspicious or fake
                    - Harassment or hateful speech
                    - Violence or physical harm
                    - Inappropriate content
                    - I don’t want to see this
                  example: Suspicious or fake
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"

  /v1/settings:
    get:
      summary: setting
      description: ""
      tags:
        - Setting
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"      

  /v1/device-tokens:
    post:
      summary: Register device token
      description: "deviceType: ios | android"
      tags:
        - Device Token
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                deviceId:
                  type: string
                  example: dbeee84d-9487-44c4-b7c9-6720d17f2b42
                deviceType:
                  type: string
                  example: ios
                token:
                  type: string
                  example: dbeee84d-9487-44c4-b7c9-6720d17f2b42-dbeee84d-dbeee84d-9487-44c4-b7c9-6720d17f2b429487-44c4-b7c9-6720d17f2b42-44c4-b7c9-6720d17f2b42
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"    

  /v1/device-tokens/send-notification:
    post:
      summary: Send test notification
      description: "type: chat_approved, chat_rejected, chat_message, admin"
      tags:
        - Device Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                token:
                  type: string
                  example: dbeee84d-9487-44c4-b7c9-6720d17f2b42-dbeee84d-dbeee84d-9487-44c4-b7c9-6720d17f2b429487-44c4-b7c9-6720d17f2b42-44c4-b7c9-6720d17f2b42
                title:
                  type: string
                  example: InTouch APP
                notification:
                  type: string
                  example: Hello everyone!
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"    

  /v1/notifications:
    get:
      summary: notifications list
      description: ""
      tags:
        - Notification
      security:
        - bearerAuth: []
      parameters:
        - in: "query"
          name: "limit"
          schema:
            type: "integer"
            example: "10"
        - in: "query"
          name: "page"
          schema:
            type: "integer"
            example: "1"
      responses:
        "200":
          $ref: "#/components/responses/successResponse"
        "422":
          $ref: "#/components/responses/errorResponse"