openapi: 3.0.0
info:
  title: Saleyo APIs
  version: 1.0.0
  description: API documentation for Saleyo
servers:
  - url: https://api-staging.saleyo.com/
    description: Staging server
  - url: http://localhost/saleyo-backend/
    description: local server
tags:
  - name: USER MODULE
  - name: HOMEPAGE MODULE
  - name: CATEGORY & SUBCATEGORY MODULE
  - name: PRODUCT MODULE
  - name: STORE MODULE
  - name: CITY & COUNTRY MODULE
  - name: MISCELLANEOUS MODULE
security:
  - bearerAuth: []
  - languageHeader: []
  - latlongHeader: []

components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    languageHeader:
      type: apiKey
      in: header
      name: Language
      description: Language for the request (e.g., en-US)
    latlongHeader:
      type: apiKey
      in: header
      name: Latlong
      description: Geolocation in the format "latitude,longitude" (e.g., 37.7749,-122.4194)

paths:
  /login-verification.php:
    post:
      tags:
        - "USER MODULE"
      summary: User login
      description: This endpoint allows users to log in using their email and password. The password is verified using SHA-1 hash comparison.
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                email:
                  type: string
                  example: "user@example.com"
                password:
                  type: string
                  example: "password123"
                fcm_token:
                  type: string
                  example: "fcm_token123456"
                device_id:
                  type: string
                  example: "device_id123456"
      responses:
        '200':
          description: Successfully logged in
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Login successful"
                  data:
                    type: object
                    properties:
                      id:
                        type: integer
                        example: 1
                      email:
                        type: string
                        example: "user@example.com"
                      name:
                        type: string
                        example: "John Doe"
                      phone:
                        type: string
                        example: "1234567890"
                      verify:
                        type: integer
                        example: 1
                      created_at:
                        type: string
                        format: date-time
                        example: "2024-11-22T12:34:56"
        '201':
          description: Your account is not verified! We've sent a verification OTP to your email. Please check your inbox to verify your account.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Your account is not verified! We've sent a verification OTP to your email. Please check your inbox to verify your account."
                  data:
                    type: object
                    properties:
                      id:
                        type: integer
                        example: 1
                      email:
                        type: string
                        example: "user@example.com"
                      name:
                        type: string
                        example: "John Doe"
                      phone:
                        type: string
                        example: "1234567890"
                      verify:
                        type: integer
                        example: 0
                      created_at:
                        type: string
                        format: date-time
                        example: "2024-11-22T12:34:56"
        '400':
          description: Invalid email or password
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Invalid email or password"
        '500':
          description: Database error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Database error"

  /registration-validation.php:
    post:
      tags:
        - "USER MODULE"
      summary: Register a new user
      description: Register a new user with the provided details and return user data upon successful registration.
      requestBody:
        description: User registration details
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Full name of the user
                  example: "John Doe"
                mobile:
                  type: integer
                  description: User's mobile number
                  example: "1234567890"
                email:
                  type: string
                  description: User's email address
                  example: "john.doe@example.com"
                password:
                  type: string
                  description: User's password (will be hashed)
                  example: "password123"
                dob:
                  type: string
                  format: date
                  description: User's date of birth in format YYYY-MM-DD
                  example: "1990-01-01"
                gender:
                  type: string
                  description: Gender of the user
                  example: "Male"
                fcm_token:
                  type: string
                  description: FCM token
                  example: "FCM token"
      responses:
        '200':
          description: Registration successful! We've sent a verification OTP to your email. Please check your inbox to verify your account.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Registration successful! We've sent a verification OTP to your email. Please check your inbox to verify your account."
                  # data:
                  #   type: array
                    # items:
                    # properties:
                    #   mid:
                    #     type: integer
                    #     description: User ID
                    #     example: 1
                    #   name:
                    #     type: string
                    #     description: Full name of the user
                    #     example: "John Doe"
                    #   contact:
                    #     type: string
                    #     description: User's mobile number
                    #     example: "1234567890"
                    #   email:
                    #     type: string
                    #     description: User's email address
                    #     example: "john.doe@example.com"
                    #   user_dob:
                    #     type: string
                    #     format: date
                    #     description: User's date of birth
                    #     example: "1990-01-01"
                    #   gender:
                    #     type: string
                    #     description: User's gender
                    #     example: "Male"
        '400':
          description: Bad request, missing or incorrect parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "All fields are required."
        '409':
          description: Conflict, user already exists
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "User already exists."
        '500':
          description: Internal server error, issue with database or connection
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Connection problem"

  /add-favorite.php:
    post:
      summary: Add an item or store to the user's favorites
      operationId: addFavorite
      tags:
        - USER MODULE
      requestBody:
        description: Request body for adding a favorite item
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                p_id:
                  type: integer
                  description: The product ID to be added to the favorites. Can be null or 0.
                  example: 7
                s_id:
                  type: integer
                  description: The store ID to be added to the favorites. Can be null or 0.
                  example: 0
                user_ip:
                  type: string
                  description: The IP address of the user.
                  example: "127.0.0.1"
      responses:
        '200':
          description: Successfully added to the user's favorites
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Added to favorite"
                  data:
                    type: object
                    properties:
                      fav_id:
                        type: string
                        example: "183"
                      fav_user_id:
                        type: string
                        example: "1"
                      fav_item_id:
                        type: string
                        example: "7"
                      fav_store_id:
                        type: string
                        example: "0"
                      fav_date:
                        type: string
                        format: date
                        example: "2024-11-23"
                      ip:
                        type: string
                        example: "127.0.0.1"
        '400':
          description: Bad request, either user_id is missing or both p_id and s_id are null or 0
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "User ID is required, and both p_id and s_id cannot be null or 0."
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error: SQL query failed or other server error."
        components:
          schemas:
            ErrorResponse:
              type: object
              properties:
                success:
                  type: boolean
                  example: false
                message:
                  type: string
                  example: "Error message"
  
  /add-review.php:
    post:
      tags:
        - USER MODULE
      summary: Submit a Product Review
      description: Submit a review for a product, including rating and review text.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                p_id:
                  type: integer
                  example: 1
                name:
                  type: string
                  example: "John Doe"
                email:
                  type: string
                  example: "john.doe@example.com"
                review_text:
                  type: string
                  example: "Great product, very satisfied!"
                rating:
                  type: integer
                  example: 5
      responses:
        '200':
          description: Successfully submitted the review
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Review submitted"
                  data:
                    type: object
                    properties:
                      lrid:
                        type: integer
                        example: 101
                      lr_lid:
                        type: integer
                        example: 1
                      lr_user:
                        type: integer
                        example: 1
                      lr_name:
                        type: string
                        example: "John Doe"
                      lr_email:
                        type: string
                        example: "john.doe@example.com"
                      lr_message:
                        type: string
                        example: "Great product, very satisfied!"
                      lr_rating:
                        type: integer
                        example: 5
                      lr_date:
                        type: string
                        format: date
                        example: "2024-11-20"
                      lr_status:
                        type: integer
                        example: 0
                      lr_ip:
                        type: string
                        example: "127.0.0.1"
                      lr_type:
                        type: string
                        example: "review"
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "All fields are required."

  /all-city-state-wise.php:
    post:
      tags:
        - CITY & COUNTRY MODULE
      summary: Get Cities by State ID
      description: Fetch a list of cities for a specific state ID.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                state_id:
                  type: integer
                  example: 1
      responses:
        '200':
          description: Successfully retrieved the cities
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Cities retrieved successfully"
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 1
                        name:
                          type: string
                          example: "New York"
        '400':
          description: Invalid input
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "State ID is required."
        '404':
          description: No cities found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No cities found for the provided state ID."
  
  /all-countries.php:
    get:
      tags:
        - CITY & COUNTRY MODULE
      summary: Get All Countries
      description: Retrieve all countries available in the system.
      responses:
        '200':
          description: Successfully retrieved countries
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Countries retrieved successfully"
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        country_id:
                          type: integer
                          example: 1
                        country_name:
                          type: string
                          example: "United States"
                        country_code:
                          type: string
                          example: "US"
                        country_iso:
                          type: string
                          example: "USA"
        '400':
          description: No countries found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No countries found"
  
  /all-products.php:
    post:
      tags:
        - PRODUCT MODULE
      summary: Get Products by Stock
      description: Retrieve all products where stock is greater than the specified value.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                p_stock:
                  type: integer
                  example: 10
      responses:
        '200':
          description: Successfully retrieved products
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Products retrieved successfully"
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        info:
                          type: object
                          properties:
                            p_id:
                              type: integer
                              example: 1
                            p_cover:
                              type: string
                              example: "assets/avator/upload/product1.jpg"
                            p_name:
                              type: string
                              example: "Product Name"
                            p_title:
                              type: string
                              example: "Product Title"
                            p_discount:
                              type: string
                              example: "10%"
                            p_price:
                              type: string
                              example: "20.00"
                            p_mrp:
                              type: string
                              example: "25.00"
                        color:
                          type: array
                          items:
                            type: object
                            properties:
                              stg_name:
                                type: string
                                example: "Red"
        '400':
          description: No products found or invalid stock value
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No products found or invalid stock value"

  /all-state-country-wise.php:
    post:
      tags:
        - CITY & COUNTRY MODULE
      summary: Get States by Country ID
      description: Retrieve all states for a given country based on country_id.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                country_id:
                  type: integer
                  example: 1
      responses:
        '200':
          description: Successfully retrieved states
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "States retrieved successfully"
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        state_id:
                          type: integer
                          example: 101
                        state_name:
                          type: string
                          example: "California"
        '400':
          description: Country ID is missing or no states found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "country_id is required or no states found"

  /category_all.php:
    get:
      tags:
        - PRODUCT MODULE
      summary: Retrieve Categories, Subcategories, and Products
      description: Retrieve categories, subcategories, and products from the database.
      responses:
        '200':
          description: Successfully retrieved categories, subcategories, and products.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Data Found."
                  data:
                    type: object
                    properties:
                      category:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: integer
                              example: 1
                            category_name:
                              type: string
                              example: "Electronics"
                      sub_category:
                        type: array
                        items:
                          type: object
                          properties:
                            subcategory_id:
                              type: integer
                              example: 101
                            category_id:
                              type: integer
                              example: 1
                            name:
                              type: string
                              example: "Smartphones"
                      product:
                        type: array
                        items:
                          type: object
                          properties:
                            product_id:
                              type: integer
                              example: 1001
                            subcategory_id:
                              type: integer
                              example: 101
                            category_id:
                              type: integer
                              example: 1
                            product_name:
                              type: string
                              example: "iPhone 14"
        '500':
          description: Server error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Internal server error"

  /category-select-all.php:
    get:
      tags:
        - CATEGORY & SUBCATEGORY MODULE
      summary: Get Categories with Image URLs
      description: Retrieve categories from the database along with image URLs.
      responses:
        '200':
          description: Successfully retrieved categories
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Categories found"
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          example: 1
                        category_name:
                          type: string
                          example: "Electronics"
                        img:
                          type: string
                          example: "assets/avator/upload/category-image.jpg"
        '404':
          description: No categories found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No categories found"
                  data:
                    type: array
                    items: {}

  /delete-favorite-item.php:
    post:
      tags:
        - "USER MODULE"
      summary: "Delete a Favorite Item or store"
      description: "Deletes a favorite item from the `yn_site_favourites` table using the provided `fav_id`."
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                fav_id:
                  type: integer
                  example: 5
                  description: "The ID of the favorite item to delete."
      responses:
        '200':
          description: "Successfully deleted the favorite item."
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Favorite item deleted."
        '400':
          description: "Invalid request or error during deletion."
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error: Database error."

  /featured-product.php:
    get:
      tags:
        - PRODUCT MODULE
      summary: Retrieve featured products
      description: Fetches featured products from the `yn_ecom_products` table where the stock is greater than 0 and the product is marked as featured.
      responses:
        '200':
          description: Successfully retrieved featured products
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Featured products found"
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        p_id:
                          type: integer
                          example: 101
                        p_cover:
                          type: string
                          example: "assets/avator/upload/product-image.jpg"
                        p_name:
                          type: string
                          example: "Product Name"
                        p_title:
                          type: string
                          example: "Product Title"
                        p_discount:
                          type: number
                          format: float
                          example: 10.5
                        p_price:
                          type: number
                          format: float
                          example: 299.99
                        p_mrp:
                          type: number
                          format: float
                          example: 399.99
        '404':
          description: No featured products found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No featured products found"
                  data:
                    type: array
                    items:
                      type: object

  /flash-sale.php:
    get:
      tags:
        - HOMEPAGE MODULE
      summary: Retrieve products on sale
      description: Fetches products that are marked for sale (`p_sale_status = 1`) and are in stock (`p_stock > 0`).
      responses:
        '200':
          description: Successfully retrieved products on sale
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Products found"
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        is_fav:
                          type: string
                          example: 1
                          description: 1=favourite
                        p_id:
                          type: integer
                          example: 101
                        p_cover:
                          type: string
                          example: "assets/avator/upload/product-image.jpg"
                        p_name:
                          type: string
                          example: "Product Name"
                        p_title:
                          type: string
                          example: "Product Title"
                        p_discount:
                          type: number
                          format: float
                          example: 15.5
                        p_price:
                          type: number
                          format: float
                          example: 249.99
                        p_mrp:
                          type: number
                          format: float
                          example: 299.99
                        p_stock:
                          type: integer
                          example: 20
        '404':
          description: No products on sale found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No products available on sale"
                  data:
                    type: array
                    items:
                      type: object

  /forgot-password-save.php:
    post:
      tags:
        - "USER MODULE"
      summary: Reset password using OTP
      description: This endpoint allows a user to reset their password by providing an email, OTP, and new password.
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                email:
                  type: string
                  format: email
                  description: The email address associated with the user's account.
                # otp:
                #   type: string
                #   description: The OTP sent to the user's email for password reset verification.
                password:
                  type: string
                  format: password
                  description: The new password for the user account.
                password1:
                  type: string
                  format: password
                  description: The confirmation of the new password to ensure correctness.
      responses:
        '200':
          description: Password reset successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Password has been updated successfully"
        '400':
          description: Bad Request - Invalid OTP or mismatched passwords
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Invalid OTP. Please check and try again."
        '404':
          description: User not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No user found with the provided email address."
        '500':
          description: Internal Server Error - Password update failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Failed to update password. Please try again."

  /send-otp.php:
    post:
      tags:
        - "USER MODULE"
      summary: Send OTP to user email for verification
      description: This endpoint allows a user to request an OTP for verifying their email address.
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                type:
                  type: string
                  enum: [email, phone ,password]
                email:
                  type: string
                  format: email
                  description: The email address to which the OTP will be sent.
      responses:
        '200':
          description: OTP sent successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "OTP sent to your email."
                  # otp:
                  #   type: string
                  #   example: "1234"
        '400':
          description: Bad Request - No user found with the provided email address
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No user found with this email address."
        '500':
          description: Internal Server Error - Email sending failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Email could not be sent. Please try again later."

  /get-favorite.php:
    get:
      tags:
        - "USER MODULE"
      summary: Retrieve a user's favorite products
      description: This endpoint retrieves the list of favorite products for a given user, including product details and associated variants (e.g., colors).
      responses:
        '200':
          description: Successfully retrieved user's favorite products
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Favorites retrieved successfully."
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        product:
                          type: object
                          properties:
                            p_id:
                              type: string
                              example: "1"
                            p_name:
                              type: string
                              example: "Product Name"
                            p_title:
                              type: string
                              example: "Product Title"
                            p_cover:
                              type: string
                              example: "assets/avator/upload/product_image.jpg"
                            p_discount:
                              type: number
                              format: float
                              example: 10.0
                            p_price:
                              type: number
                              format: float
                              example: 199.99
                            p_mrp:
                              type: number
                              format: float
                              example: 249.99
                            p_variant:
                              type: string
                              example: "1,2,3"
                        color:
                          type: array
                          items:
                            type: object
                            properties:
                              stg_name:
                                type: string
                                example: "Red"
        '400':
          description: Bad Request - Invalid or missing user_id
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Invalid or missing user_id."
        '404':
          description: No favorites found for the given user
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No favorites found for the given user."
        '500':
          description: Internal Server Error - Database query failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error retrieving favorites. Please try again later."

  /item-reserved.php:
    post:
      tags:
        - USER MODULE
      summary: Reserve a product for a user
      description: This endpoint allows a user to reserve a product, and it returns the product details if successfully reserved.
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                p_id:
                  type: integer
                  description: The ID of the product being reserved.
                store_variant_map_id:
                  type: integer
                  description: Store variant mapping id.
                quantity:
                  type: integer
                  description: Enter reserve quantity
      responses:
        '200':
          description: Successfully reserved the product
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Product reserved successfully."
                  data:
                    type: object
                    properties:
                      store_variant_map_id:
                        type: string
                        example: "1"
                      product_id:
                        type: string
                        example: "1"
                      variant_id:
                        type: string
                        example: "1"
                      value_id:
                        type: string
                        example: "1"
                      store_id:
                        type: string
                        example: "1"
                      discount:
                        type: number
                        format: float
                        example: 249.99
                      price:
                        type: number
                        format: float
                        example: 249.99
                      mrp_price:
                        type: number
                        format: float
                        example: 249.99
                      stock_quantity:
                        type: string
                        example: "2"
                      status:
                        type: string
                        example: "1"
                      p_name:
                        type: string
                        example: "Product Name"
                      p_title:
                        type: string
                        example: "Product Title"
                      p_cover:
                        type: string
                        example: "assets/avator/upload/product_image.jpg"
                      p_descp:
                        type: string
                        example: "Product Desc"
                      sku:
                        type: string
                        example: "SKU"
                      variant_description:
                        type: string
                        example: "Variant desc"
                      attribute_name:
                        type: string
                        example: "Size,Color"
                      attribute_value:
                        type: string
                        example: "10"
                      s_name:
                        type: string
                        example: "Nike Doha City Centre"
                      s_opening:
                        type: string
                        example: "08:00 am"
                      s_closing:
                        type: string
                        example: "0p:00 pm"
                      s_image:
                        type: string
                        example: "assets/avator/upload/product_image.jpg"
                      s_google_loc:
                        type: string
                        example: "https://www.google.com/maps/dir//nike+doha+city+center+google+map/data=!4m6!4m5!1m1!4e2!1m2!1m1!1s0x3e45c4c753f162e1:0x86b662451f1e88d5?sa=X&ved=2ahUKEwiX9qTy_sT_AhWjTKQEHSo5DYwQ9Rd6BAhHEAQ"
                      display_text:
                        type: string
                        example: "This item is available until11:43 am, 10th February 2025 in Nike Doha City Centre"
                     
        '400':
          description: Bad Request - Missing required parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Product & User ID are required."
        '500':
          description: Internal Server Error - Database query failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error reserving product. Please try again later."

  /just-for-you.php:
    get:
      tags:
        - HOMEPAGE MODULE
      summary: Retrieve a list of products in stock
      description: This endpoint retrieves the most recent products with details like name, title, price, discount, and available variants (color).
      responses:
        '200':
          description: Successfully retrieved the list of products
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Products retrieved successfully."
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        info:
                          type: object
                          properties:
                            is_fav:
                              type: string
                              example: 1
                              description: 1=favourite
                            p_id:
                              type: string
                              example: "1"
                            p_cover:
                              type: string
                              example: "assets/avator/upload/product_image.jpg"
                            p_name:
                              type: string
                              example: "Product Name"
                            p_title:
                              type: string
                              example: "Product Title"
                            p_discount:
                              type: number
                              format: float
                              example: 10.0
                            p_price:
                              type: number
                              format: float
                              example: 199.99
                            p_mrp:
                              type: number
                              format: float
                              example: 249.99
                        color:
                          type: array
                          items:
                            type: object
                            properties:
                              stg_name:
                                type: string
                                example: "Red"
        '404':
          description: No products found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No products found."
                  data:
                    type: array
                    items: {}

  /malls-near-you.php:
    get:
      tags:
        - STORE MODULE
      summary: Fetch all stores data
      description: This endpoint retrieves data for all stores, including store details such as images and names.
      responses:
        '200':
          description: Successfully retrieved stores data
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Stores data fetched successfully"
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        s_id:
                          type: integer
                          example: 1
                        s_name:
                          type: string
                          example: "Store A"
                        s_address:
                          type: string
                          example: "123 Main St"
                        s_phone:
                          type: string
                          example: "1234567890"
                        s_image:
                          type: string
                          example: "assets/avator/upload/store_image.jpg"
        '400':
          description: No stores found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No stores found"
        '500':
          description: Database error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Database error"

  /preference-save.php:
    post:
      tags:
        - USER MODULE
      summary: Update user preference
      description: This endpoint updates a user's preference by modifying the `preference` field in the `yn_site_mem` table.
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                cid:
                  type: string
                  description: The category ID that the user prefers.
              required:
                - cid
      responses:
        '200':
          description: Successfully updated user preference
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Preference Saved"
                  data:
                    type: object
                    properties:
                      mid:
                        type: integer
                        example: 123
                      email:
                        type: string
                        example: "user@example.com"
                      name:
                        type: string
                        example: "John Doe"
                      preference:
                        type: string
                        example: "category_1"
        '400':
          description: Missing required parameters (user_id or cid)
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "User ID and Category ID are required."
        '404':
          description: User not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "User not found."
        '500':
          description: Database error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error: <error_message>"

  /product-details.php:
    post:
      tags:
        - PRODUCT MODULE
      summary: Fetch product details by product ID
      description: This endpoint retrieves the details of a product by its ID, including product details, images, reviews, and variants (color, size, and brand).
      parameters:
        - name: p_id
          in: query
          required: true
          description: The unique product ID for which details are being fetched.
          schema:
            type: integer
      responses:
        '200':
          description: Successfully fetched product details
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Product details fetched successfully"
                  data:
                    type: object
                    properties:
                      details:
                        type: object
                        properties:
                          p_id:
                            type: integer
                            example: 101
                          p_name:
                            type: string
                            example: "Product Name"
                          p_description:
                            type: string
                            example: "Product description goes here."
                          p_cover:
                            type: string
                            example: "assets/avator/upload/product_cover.jpg"
                      image:
                        type: array
                        items:
                          type: object
                          properties:
                            img:
                              type: string
                              example: "assets/avator/upload/product_image.jpg"
                      review:
                        type: array
                        items:
                          type: object
                          properties:
                            lr_lid:
                              type: integer
                              example: 101
                            review:
                              type: string
                              example: "Great product!"
                      color:
                        type: array
                        items:
                          type: object
                          properties:
                            stg_tgid:
                              type: integer
                              example: 1
                            stg_name:
                              type: string
                              example: "Red"
                      size:
                        type: array
                        items:
                          type: object
                          properties:
                            stg_tgid:
                              type: integer
                              example: 2
                            stg_name:
                              type: string
                              example: "M"
                      brand:
                        type: array
                        items:
                          type: object
                          properties:
                            stg_tgid:
                              type: integer
                              example: 3
                            stg_name:
                              type: string
                              example: "BrandName"
                            stg_img:
                              type: string
                              example: "assets/avator/upload/brand_image.jpg"
        '400':
          description: Missing product ID parameter
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Product ID is required."
        '404':
          description: Product not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Product not found."
        '500':
          description: Database error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error: <error_message>"

  /search-product.php:
    post:
      tags:
        - PRODUCT MODULE
      summary: Search for products
      description: Search for products by name and return relevant results including product details and variants.
      parameters:
        - name: search_text
          in: query
          required: true
          description: The search term to look for in product names.
          schema:
            type: string
            example: "shirt"
      responses:
        '200':
          description: Successful search result
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Search results found."
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        product:
                          type: object
                          properties:
                            p_id:
                              type: integer
                              description: Product ID
                              example: 101
                            p_name:
                              type: string
                              description: Product name
                              example: "Cotton Shirt"
                            p_title:
                              type: string
                              description: Product title
                              example: "High-quality cotton shirt"
                            p_cover:
                              type: string
                              description: URL of the product cover image
                              example: "assets/avator/upload/product_cover.jpg"
                            p_discount:
                              type: number
                              description: Discount on the product
                              example: 20
                            p_price:
                              type: number
                              description: Price of the product
                              example: 100
                            p_mrp:
                              type: number
                              description: MRP of the product
                              example: 120
                            p_variant:
                              type: string
                              description: Comma-separated list of variant IDs
                              example: "1,2,3"
                        color:
                          type: array
                          items:
                            type: object
                            properties:
                              stg_name:
                                type: string
                                description: Color variant name
                                example: "Red"
        '400':
          description: Invalid search input (e.g., search text too short)
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Please provide a valid search text."
        '404':
          description: No products found matching the search criteria
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No products found matching the search criteria."
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Server error"

  /slider-banner.php:
    get:
      tags:
        - HOMEPAGE MODULE
      summary: Fetch the latest images
      description: Retrieves the latest 5 images from the database and returns them in the response.
      responses:
        '200':
          description: Successfully fetched images
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Images fetched successfully."
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        img_id:
                          type: integer
                          description: Image ID
                          example: 101
                        img_name:
                          type: string
                          description: URL of the image
                          example: "assets/avator/upload/image1.jpg"
        '404':
          description: No images found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No images found."
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Server error"

  /store-finder.php:
    get:
      tags:
        - STORE MODULE
      summary: Fetch stores
      description: Retrieves all stores from the database and returns them in the response.
      responses:
        '200':
          description: Successfully fetched stores
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Stores fetched successfully."
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        store_id:
                          type: integer
                          description: Store ID
                          example: 101
                        store_name:
                          type: string
                          description: Store name
                          example: "SuperMart"
                        store_location:
                          type: string
                          description: Store location
                          example: "123 Main St, City, Country"
        '404':
          description: No stores found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No stores found."
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Server error"

  /subcategory-select-all.php:
    post:
      tags:
        - CATEGORY & SUBCATEGORY MODULE
      summary: Fetch subcategories by category ID
      description: Retrieves all subcategories for a given category ID from the database and returns them in the response.
      parameters:
        - name: ctid
          in: query
          required: false
          description: Category ID to fetch subcategories
          schema:
            type: integer
            example: 5
      responses:
        '200':
          description: Successfully fetched subcategories
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Subcategories fetched successfully."
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        sc_id:
                          type: integer
                          description: Subcategory ID
                          example: 10
                        sc_name:
                          type: string
                          description: Subcategory name
                          example: "Laptops"
                        sc_img:
                          type: string
                          description: URL to the subcategory image
                          example: "assets/avator/upload/laptop.jpg"
        '404':
          description: No subcategories found for the given category ID
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No subcategories found for the provided category ID."
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Server error"

  /subcategory-with-product.php:
    post:
      tags:
        - PRODUCT MODULE
      summary: Fetch subcategories and products by category and subcategory IDs
      description: Retrieves subcategories and associated products for a given category and subcategory ID from the database and returns them in the response.
      parameters:
        - name: ctid
          in: query
          required: true
          description: Category ID to fetch subcategories and products
          schema:
            type: integer
            example: 5
        - name: scid
          in: query
          required: true
          description: Subcategory ID to fetch associated products
          schema:
            type: integer
            example: 10
      responses:
        '200':
          description: Successfully fetched subcategories and products
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Subcategories and products fetched successfully."
                  data:
                    type: object
                    properties:
                      subcategory:
                        type: array
                        items:
                          type: object
                          properties:
                            mr_sub2_id:
                              type: integer
                              description: Subcategory ID
                              example: 101
                            mr_sub2_name:
                              type: string
                              description: Subcategory name
                              example: "Smartphones"
                            mr_sub2_img:
                              type: string
                              description: URL to the subcategory image
                              example: "assets/avator/upload/smartphone.jpg"
                      product:
                        type: array
                        items:
                          type: object
                          properties:
                            p_id:
                              type: integer
                              description: Product ID
                              example: 123
                            p_name:
                              type: string
                              description: Product name
                              example: "iPhone 13"
                            p_cover:
                              type: string
                              description: URL to the product cover image
                              example: "assets/avator/upload/iphone13.jpg"
        '404':
          description: No subcategories or products found for the given category and subcategory IDs
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No subcategories or products found for the provided category and subcategory."
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Server error"

  /subscribe-email-user.php:
    post:
      tags:
        - USER MODULE
      summary: Subscribe a user by email and record their IP address
      description: This endpoint allows a user to subscribe by providing an email address and their IP address. The subscription data is stored in the database.
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                email:
                  type: string
                  description: The email address of the user subscribing
                  example: "user@example.com"
                user_ip:
                  type: string
                  description: The IP address of the user subscribing
                  example: "192.168.1.1"
      responses:
        '200':
          description: Successfully subscribed the user
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Subscription successful."
        '400':
          description: Email is required or invalid input
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Email is required."
        '500':
          description: Server error during subscription
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error: [error message]"

  /trending-new-products.php:
    get:
      tags:
        - HOMEPAGE MODULE
      summary: Get all trending products with details
      description: This endpoint returns a list of trending products that are in stock. It includes product details like name, title, price, stock, and color variants.
      responses:
        '200':
          description: A list of trending products successfully fetched
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Products fetched successfully."
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        info:
                          type: object
                          properties:
                            is_fav:
                              type: string
                              example: 1
                              description: 1=favourite
                            p_id:
                              type: integer
                              example: 1
                            p_cover:
                              type: string
                              format: uri
                              example: "assets/avator/upload/product_image.jpg"
                            p_name:
                              type: string
                              example: "Product Name"
                            p_title:
                              type: string
                              example: "Product Title"
                            p_discount:
                              type: integer
                              example: 10
                            p_price:
                              type: number
                              format: float
                              example: 100.50
                            p_mrp:
                              type: number
                              format: float
                              example: 150.00
                            p_stock:
                              type: integer
                              example: 25
                        color:
                          type: array
                          items:
                            type: object
                            properties:
                              stg_name:
                                type: string
                                example: "Red"
        '404':
          description: No trending products found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No trending products found."
        '500':
          description: Server error while fetching products
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error: [error message]"

  /update-profile.php:
    post:
      summary: Update user profile (email, phone, or password)
      tags:
        - "USER MODULE"
      operationId: updateProfile
      parameters:
        - name: otp
          in: query
          required: true
          schema:
            type: integer
            description: Otp received from send-otp api.
        - name: type
          in: query
          required: true
          schema:
            type: string
            enum: [email, phone, password]
            description: The type of field to update (email, phone, or password).
        - name: current
          in: query
          required: true
          schema:
            type: string
            description: The current value of the field to be updated.
        - name: new
          in: query
          required: true
          schema:
            type: string
            description: The new value to update the field to.
      responses:
        '200':
          description: Profile updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Email updated successfully."
                  data:
                    type: object
                    properties:
                      mid:
                        type: integer
                        example: 123
                      email:
                        type: string
                        example: "new-email@example.com"
                      contact:
                        type: string
                        example: "1234567890"
                      pass:
                        type: string
                        example: "hashedpassword"
                      created_at:
                        type: string
                        format: date-time
                        example: "2024-11-29T12:00:00Z"
        '400':
          description: Bad request due to missing or invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "All fields are required."
        '404':
          description: User not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "User not found."
        '500':
          description: Error while updating user profile in the database
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error updating profile: [error message]"

  /get-store-details.php:
    get:
      tags:
        - STORE MODULE
      summary: Get Store Details
      description: Retrieve details of a specific store by its ID.
      parameters:
        - name: store_id
          in: query
          required: true
          description: The ID of the store to retrieve.
          schema:
            type: integer
        - name: type
          in: query
          required: true
          description: Type of the tab which data you want to fetch. (eg. home, allproduct, new_arrival, on_sale)
          schema:
            type: string    
        - name: color
          in: query
          required: false
          description: if Type = 'allproduct' then this filter will work eg (blue,red).
          schema:
            type: string
        - name: gender
          in: query
          required: false
          description: if Type = 'allproduct' then this filter will work eg (male,female).
          schema:
            type: string
        - name: preference
          in: query
          required: false
          description: if Type = 'allproduct' then this filter will work eg (Price High to Low = high_to_low,Price Low to High = low_to_high, Best Match = best_match, Relevance = relevance).
          schema:
            type: string        
      responses:
        '200':
          description: Store details retrieved successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Store details found."
                  data:
                    type: object
                    properties:
                      s_id:
                        type: integer
                        example: 1
                      s_name:
                        type: string
                        example: "Nike Doha City Centre"
                      s_opening:
                        type: string
                        example: "08:00 am"
                      s_closing:
                        type: string
                        example: "09:00 pm"
                      s_image:
                        type: string
                        example: "353407030nikeepng.png.png"
                      s_google_loc:
                        type: string
                        example: "https://www.google.com/maps/dir//nike+doha+city+center+google+map/data=!4m6!4m5!1m1!4e2!1m2!1m1!1s0x3e45c4c753f162e1:0x86b662451f1e88d5?sa=X&ved=2ahUKEwiX9qTy_sT_AhWjTKQEHSo5DYwQ9Rd6BAhHEAQ"
                      s_status:
                        type: integer
                        example: 1
        '404':
          description: Store not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Store not found."

  /search-stores.php:
    get:
      tags:
        - STORE MODULE
      summary: Search Stores
      description: Search for stores by keyword or other filters.
      parameters:
        - name: keyword
          in: query
          required: false
          description: Keyword to search for stores (e.g., name, location).
      responses:
        '200':
          description: Stores found successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Stores found."
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        s_id:
                          type: integer
                          example: 2
                        s_name:
                          type: string
                          example: "Mall of Qatar"
                        s_opening:
                          type: string
                          example: "08:00 am"
                        s_closing:
                          type: string
                          example: "11:00 pm"
                        s_image:
                          type: string
                          example: "204321343nikewebp.webp.webp"
                        s_google_loc:
                          type: string
                          example: "https://www.google.com/maps/dir/24.8770503,67.129867/The+Mall+Qatar,+D+Ring+Rd,+Doha,+Qatar/@27.7193849,48.3182822,5z/data=!4m9!4m8!1m1!4e1!1m5!1m1!1s0x3e45cf931f91a61b:0xe4a2b972d831df82!2m2!1d51.5373453!2d25.2531648?entry=ttu"
                        s_status:
                          type: integer
                          example: 1
        '404':
          description: No stores found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No stores found."

  /get-products-by-store.php:
    get:
      tags:
        - PRODUCT MODULE
      summary: Get Products by Store
      description: Fetch all products available for a specific store.
      parameters:
        - name: store_id
          in: query
          required: true
          description: The ID of the store to fetch products for.
          schema:
            type: integer
      responses:
        '200':
          description: Products found successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Products found."
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        p_id:
                          type: integer
                          example: 1
                        p_name:
                          type: string
                          example: "Nike Free Metcon 4"
                        p_title:
                          type: string
                          example: "Nike Free Metcon 4"
                        p_category:
                          type: integer
                          example: 2
                        p_sub_category:
                          type: integer
                          nullable: true
                          example: 0
                        p_sub_sub_category:
                          type: integer
                          nullable: true
                          example: null
                        p_descp:
                          type: string
                          example: "<p>Lorem ipsum dolor sit amet consectetur...</p>"
                        p_brand_name:
                          type: string
                          example: "8"
                        p_link:
                          type: string
                          nullable: true
                          example: null
                        p_discount:
                          type: integer
                          example: 0
                        p_price:
                          type: number
                          example: 96
                        p_mrp:
                          type: number
                          example: 96
                        p_stock:
                          type: integer
                          example: 40
                        p_cashback:
                          type: string
                          nullable: true
                          example: null
                        p_brand_image:
                          type: string
                          nullable: true
                          example: null
                        p_image1:
                          type: string
                          example: "986616636p23png.png.png"
                        p_image2:
                          type: string
                          nullable: true
                          example: null
                        p_image3:
                          type: string
                          nullable: true
                          example: null
                        p_star:
                          type: string
                          example: "4"
                        p_status:
                          type: integer
                          example: 1
                        p_number_of_reviews:
                          type: integer
                          example: 0
                        p_variant:
                          type: string
                          example: "1,2,3,4,5,6"
                        p_provider:
                          type: string
                          nullable: true
                          example: null
                        p_sale_status:
                          type: integer
                          example: 1
                        p_featured:
                          type: integer
                          example: 1
                        p_trending:
                          type: integer
                          example: 1
                        p_slider_status:
                          type: integer
                          example: 0
                        p_variant_text:
                          type: string
                          example: "Blue,Red,Green,US10,US11"
                        p_cover:
                          type: string
                          example: "908068551p23png.png"
                        p_sku:
                          type: string
                          example: "178342"
                        p_tags:
                          type: string
                          example: "shoes,nike"
                        p_cta:
                          type: string
                          nullable: true
                          example: ""
                        p_stores:
                          type: string
                          example: "1,2"
                        timestamp:
                          type: string
                          format: date-time
                          example: "2023-09-01 20:08:55"
        '404':
          description: No products found for the store.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No products found for the specified store."

  /get-fav-stores.php:
    get:
      summary: Get list of favorite stores for a user
      operationId: getFavStores
      tags:
        - STORE MODULE
      responses:
        '200':
          description: Successfully retrieved the list of favorite stores
          content:
            multipart/form-data:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Favorites retrieved successfully."
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        s_id:
                          type: string
                          example: "1"
                        s_name:
                          type: string
                          example: "Nike Doha City Centre"
                        s_opening:
                          type: string
                          example: "08:00 am"
                        s_closing:
                          type: string
                          example: "09:00 pm"
                        s_image:
                          type: string
                          example: "353407030nikeepng.png.png"
                        s_google_loc:
                          type: string
                          example: "https://www.google.com/maps/dir//nike+doha+city+center+google+map/data=!4m6!4m5!1m1!4e2!1m2!1m1!1s0x3e45c4c753f162e1:0x86b662451f1e88d5?sa=X&ved=2ahUKEwiX9qTy_sT_AhWjTKQEHSo5DYwQ9Rd6BAhHEAQ"
                        s_status:
                          type: string
                          example: "1"
        '400':
          description: Bad request, missing or invalid `user_id` query parameter
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "User ID is required."
        '404':
          description: No favorites found for the given user
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No favorites found for the given user."
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error: SQL query failed or other server error."
        components:
          schemas:
            ErrorResponse:
              type: object
              properties:
                success:
                  type: boolean
                  example: false
                message:
                  type: string
                  example: "Error message"

  /get-homepage.php:
    get:
      summary: Retrieve data for the homepage
      tags:
        - PRODUCT MODULE
      description: Fetches banners, categories, trending products, flash sale items, and more for the homepage.
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Home page data retrieved successfully
                  data:
                    type: object
                    properties:
                      banners:
                        type: array
                        items:
                          type: object
                          properties:
                            img_id:
                              type: integer
                              example: 1
                            img_name:
                              type: string
                              example: https://example.com/image1.jpg
                      categories:
                        type: array
                        items:
                          type: object
                          properties:
                            categoryName:
                              type: string
                              example: Electronics
                            subcategories:
                              type: array
                              items:
                                type: object
                                properties:
                                  subcategoryName:
                                    type: string
                                    example: Mobile Phones
                                  image:
                                    type: string
                                    example: https://example.com/subcategory-image.jpg
                                  backgroundColor:
                                    type: string
                                    example: "#f5f5f5"
                                  items:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        p_id:
                                          type: integer
                                          example: 101
                                        p_name:
                                          type: string
                                          example: iPhone 14
                                        p_cover:
                                          type: string
                                          example: https://example.com/product-image.jpg
                      more:
                        type: array
                        items:
                          type: object
                          properties:
                            subcategoryName:
                              type: string
                              example: Tablets
                            image:
                              type: string
                              example: https://example.com/tablets.jpg
                      trending:
                        type: array
                        items:
                          type: object
                          properties:
                            p_id:
                              type: integer
                              example: 102
                            p_name:
                              type: string
                              example: Samsung Galaxy
                            p_cover:
                              type: string
                              example: https://example.com/product-image.jpg
                      flashSale:
                        type: array
                        items:
                          type: object
                          properties:
                            p_id:
                              type: integer
                              example: 103
                            p_name:
                              type: string
                              example: Sony PlayStation 5
                            p_cover:
                              type: string
                              example: https://example.com/product-image.jpg
                      justForYou:
                        type: array
                        items:
                          type: object
                          properties:
                            p_id:
                              type: integer
                              example: 104
                            p_name:
                              type: string
                              example: Dell XPS 15
                            p_cover:
                              type: string
                              example: https://example.com/product-image.jpg
                      brandsForYou:
                        type: array
                        items:
                          type: object
                          properties:
                            categoryName:
                              type: string
                              example: Apparel
                            items:
                              type: array
                              items:
                                type: object
                                properties:
                                  storeId:
                                    type: integer
                                    example: 201
                                  storeName:
                                    type: string
                                    example: Zara
                                  storeImage:
                                    type: string
                                    example: https://example.com/store-image.jpg
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: An error occurred while retrieving the homepage data.

  /algolia-product-search.php:
    post:
      summary: Search the products using keyword
      tags:
        - PRODUCT MODULE
      description: Fetch all products available for a specific keywords.
      parameters:
        - name: keyword
          in: query
          required: true
          description: The keyword to fetch products for.
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Products data retrieved successfully
                  data:
                    type: object
                    properties:
                      
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error: [error message]"

  /add-wishlist.php:
    post:
      summary: Adds a product to the user's wishlist
      operationId: addToWishlist
      tags:
        - USER MODULE
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                p_id:
                  type: integer
                  description: The ID of the product being added to the wishlist.
                user_ip:
                  type: string
                  description: The IP address of the user.
                  example: "127.0.0.1"
            required: true
      responses:
        200:
          description: Successfully added product to wishlist
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Added to wishlist"
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        example: "2"
                      user_id:
                        type: string
                        example: "1"
                      product_id:
                        type: string
                        example: "1"
                      created_at:
                        type: string
                        format: date
                        example: "2024-11-25"
                      ip:
                        type: string
                        example: "127.0.0.1"
        400:
          description: Bad Request - Missing or invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "All fields are required"
        500:
          description: Internal Server Error - Could not process the request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error: [SQL query error message]"

  /get-wishlist.php:
    get:
      summary: Retrieves the user's wishlist
      operationId: getWishlist
      tags:
        - USER MODULE
      responses:
        200:
          description: Successfully retrieved the wishlist
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Wishlist retrieved successfully."
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        p_id:
                          type: string
                          example: "1"
                        p_name:
                          type: string
                          example: "Nike Free Metcon 4"
                        p_title:
                          type: string
                          example: "Nike Free Metcon 4"
                        p_category:
                          type: string
                          example: "2"
                        p_sub_category:
                          type: string
                          example: "0"
                        p_sub_sub_category:
                          type: string
                          nullable: true
                          example: null
                        p_descp:
                          type: string
                          example: "<p>Lorem ipsum dolor sit amet consectetur. Elementum volutpat turpis nunc lectus donec sit turpis lorem. Lectus eu non nulla.</p>"
                        p_brand_name:
                          type: string
                          example: "8"
                        p_link:
                          type: string
                          nullable: true
                          example: null
                        p_discount:
                          type: string
                          example: "0"
                        p_price:
                          type: string
                          example: "96"
                        p_mrp:
                          type: string
                          example: "96"
                        p_stock:
                          type: string
                          example: "40"
                        p_cashback:
                          type: string
                          nullable: true
                          example: null
                        p_brand_image:
                          type: string
                          nullable: true
                          example: null
                        p_image1:
                          type: string
                          example: "986616636p23png.png.png"
                        p_image2:
                          type: string
                          nullable: true
                          example: null
                        p_image3:
                          type: string
                          nullable: true
                          example: null
                        p_star:
                          type: string
                          example: "4"
                        p_status:
                          type: string
                          example: "1"
                        p_number_of_reviews:
                          type: string
                          example: "0"
                        p_variant:
                          type: string
                          example: "1,2,3,4,5,6"
                        p_provider:
                          type: string
                          nullable: true
                          example: null
                        p_sale_status:
                          type: string
                          example: "1"
                        p_featured:
                          type: string
                          example: "1"
                        p_trending:
                          type: string
                          example: "1"
                        p_slider_status:
                          type: string
                          example: "0"
                        p_variant_text:
                          type: string
                          example: "Blue,Red,Green,US10,US10,US11"
                        p_cover:
                          type: string
                          example: "908068551p23png.png"
                        p_sku:
                          type: string
                          example: "178342"
                        p_tags:
                          type: string
                          example: "shoes,nike"
                        p_cta:
                          type: string
                          nullable: true
                          example: ""
                        p_stores:
                          type: string
                          example: "1,2"
                        timestamp:
                          type: string
                          format: date-time
                          example: "2023-09-01 20:08:55"
        400:
          description: Bad Request - Missing or invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No wishlist found for the given user."
        500:
          description: Internal Server Error - Could not process the request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error: [SQL query error message]"

  /delete-wishlist.php:
    post:
      summary: Deletes an item from the user's wishlist
      operationId: deleteWishlist
      tags:
        - USER MODULE
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                id:
                  type: integer
                  description: The ID of the wishlist item to be deleted.
            required: true
      responses:
        200:
          description: Successfully deleted the wishlist item
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Wishlist item deleted"
        400:
          description: Bad Request - Missing or invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error: Missing or invalid item ID"
        500:
          description: Internal Server Error - Could not process the request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error: [SQL query error message]"

  /verify-otp.php:
    post:
      summary: Verifies the OTP for password reset
      description: Verifies the OTP sent to the user's email for password reset.
      operationId: verifyOtp
      tags:
        - USER MODULE
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                email:
                  type: string
                  description: The email address of the user attempting to verify the OTP.
                  example: user@example.com
                otp:
                  type: string
                  description: The OTP provided by the user for verification.
                  example: "1234"
                type:
                  type: string
                  enum: [forgot, register, change_email ,change_password, login]
              required:
                - email
                - otp
      responses:
        '200':
          description: OTP verification result
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether the OTP verification was successful or not.
                    example: true
                  message:
                    type: string
                    description: The message indicating the status of the OTP verification.
                    example: OTP is valid.
                  data:
                    type: object
                    items:
                    properties:
                      mid:
                        type: string
                        description: User ID
                        example: "111"
                      name:
                        type: string
                        description: Full name of the user
                        example: "John Doe"
                      pass_reset:
                        type: string
                        description: Password reset code
                        example: "5530"
                      email:
                        type: string
                        description: User's email address
                        example: "user@example.com"
                      access_token:
                        type: string
                        nullable: true
                        description: Access token for the user
                        example: null
                      token_expiry:
                        type: string
                        nullable: true
                        description: Token expiry date and time
                        example: null
                      fcm_token:
                        type: string
                        description: Firebase Cloud Messaging token
                        example: "Token"
                      contact:
                        type: string
                        description: User's mobile number
                        example: "1234567890"
                      user_dob:
                        type: string
                        format: date
                        description: User's date of birth
                        example: "1997-10-01"
                      date:
                        type: string
                        format: date-time
                        description: Date and time of the operation
                        example: "2024-12-03 11:46:26"
                      verify:
                        type: integer
                        description: User account verified status
                        example: 1
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Indicates that the request was unsuccessful.
                    example: false
                  message:
                    type: string
                    description: The error message.
                    example: Email and OTP are required.
        '404':
          description: User not found or OTP mismatch
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Indicates that the request was unsuccessful.
                    example: false
                  message:
                    type: string
                    description: The error message.
                    example: No user found with the provided email address.
        '401':
          description: Invalid OTP
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Indicates that the request was unsuccessful due to invalid OTP.
                    example: false
                  message:
                    type: string
                    description: The error message.
                    example: Invalid OTP. Please check and try again.

  /brands-for-you.php:
    get:
      summary: Retrieve categories and stores
      tags:
        - HOMEPAGE MODULE
      description: This endpoint retrieves a list of categories and their associated stores.
      responses:
        '200':
          description: Successful response with categories and stores.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Data retrieved successfully.
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        categoryName:
                          type: string
                          description: Name of the category.
                          example: Electronics
                        items:
                          type: array
                          description: List of stores associated with the category.
                          items:
                            type: object
                            properties:
                              storeId:
                                type: integer
                                description: Unique identifier for the store.
                                example: 101
                              storeName:
                                type: string
                                description: Name of the store.
                                example: BestBuy
                              storeImage:
                                type: string
                                description: URL of the store's image.
                                example: assets/brands/store-image.jpg
        '404':
          description: No data found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: No data found

  /homepage-categories.php:
    get:
      summary: Get homepage categories with subcategories and products
      tags:
        - HOMEPAGE MODULE
      description: Retrieves a list of categories (up to 3 categories) with their subcategories and products for the homepage.
      operationId: HomepageCategories
      responses:
        '200':
          description: Successfully retrieved the homepage categories and their data
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Data retrieved successfully.
                  data:
                    type: object
                    properties:
                      categories:
                        type: array
                        items:
                          type: object
                          properties:
                            categoryName:
                              type: string
                              example: "Electronics"
                            subcategories:
                              type: array
                              items:
                                type: object
                                properties:
                                  subcategoryName:
                                    type: string
                                    example: "Mobile Phones"
                                  image:
                                    type: string
                                    format: uri
                                    example: "assets/avator/upload/mobile_phones.png"
                                  backgroundColor:
                                    type: string
                                    example: "#f5f5f5"
                                  items:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        p_id:
                                          type: integer
                                          example: 1
                                        p_name:
                                          type: string
                                          example: "iPhone 14"
                                        p_cover:
                                          type: string
                                          format: uri
                                          example: "assets/products/iphone14.png"
                            more:
                              type: array
                              items:
                                type: object
                                properties:
                                  categoryName:
                                    type: string
                                    example: "Furniture"
                                  categoryImage:
                                    type: string
                                    format: uri
                                    example: "assets/avator/upload/furniture.png"
        '404':
          description: No data found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: No data found

  /notification.php:
    get:
      tags:
        - MISCELLANEOUS MODULE
      summary: Fetch notifications for the current date
      description: This endpoint retrieves notifications for the current date, including details like message and image.
      responses:
        '200':
          description: Successfully retrieved notifications data
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Notifications fetched successfully"
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        notification_id:
                          type: integer
                          example: 1
                        message:
                          type: string
                          example: "Your order has been shipped."
                        date:
                          type: string
                          format: date
                          example: "2024-11-22"
                        image:
                          type: string
                          example: "assets/notification/notification_image.jpg"
        '400':
          description: No notifications found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No notifications found"
        '500':
          description: Database error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Database error"

  /all-blogs.php:
    get:
      tags:
        - MISCELLANEOUS MODULE
      summary: Get All Blogs
      description: Retrieve all blog entries with their associated data.
      responses:
        '200':
          description: Successfully retrieved the blogs
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Blogs retrieved successfully"
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        blog_id:
                          type: integer
                          example: 1
                        blog_title:
                          type: string
                          example: "Sample Blog Post"
                        blog_content:
                          type: string
                          example: "This is a sample blog content."
                        blog_img:
                          type: string
                          example: "assets/avator/upload/sample.jpg"
                        blog_date:
                          type: string
                          format: date
                          example: "2024-11-20"
        '400':
          description: No blogs found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No blogs found"

  /faq-all.php:
    get:
      tags:
        - MISCELLANEOUS MODULE
      summary: Retrieve all FAQ records
      description: Fetches all records from the `yn_site_faq` table.
      responses:
        '200':
          description: Successfully retrieved FAQ records
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Data found"
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        faq_id:
                          type: integer
                          example: 1
                        question:
                          type: string
                          example: "What is the purpose of this website?"
                        answer:
                          type: string
                          example: "The purpose of this website is to connect photographers and clients."
        '404':
          description: No FAQ records found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No data found"
                  data:
                    type: array
                    items:
                      type: object

  /guest-user.php:
    post:
      summary: Inserts device token and generates an access token for a guest user
      operationId: guestUser
      tags:
        - USER MODULE
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                device_token:
                  type: string
                  description: The device token to associate with the user.
                  example: "some_device_token"
                fcm_token:
                  type: string
                  description: The Firebase Cloud Messaging token for the device.
                  example: "some_fcm_token"
              required:
                - device_token
      responses:
        200:
          description: Successfully inserted device token and generated access token
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Record inserted successfully."
                  data:
                    type: object
                    properties:
                      id:
                        type: integer
                        example: 1
                      user_id:
                        type: integer
                        example: 0
                      device_token:
                        type: string
                        example: "some_device_token"
                      access_token:
                        type: string
                        example: "generated_access_token"
                      token_expiry:
                        type: string
                        format: date-time
                        example: "2024-12-05T13:00:00"
        400:
          description: Bad Request - Missing or invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Device Token is required."
        500:
          description: Internal Server Error - Could not process the request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "An error occurred."
                  error:
                    type: string
                    example: "Error: [SQL query error message]"

  /delete-user.php:
    delete:
      summary: Deletes the authenticated user
      operationId: deleteUser
      tags:
        - USER MODULE
      responses:
        200:
          description: Successfully deleted the user
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "User deleted successfully."
        400:
          description: Bad Request - Missing or invalid user ID (if user data is missing from the authentication context)
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "User data is missing or invalid."
        404:
          description: Not Found - User not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "User not found."
        500:
          description: Internal Server Error - Could not process the request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "An error occurred."
                  error:
                    type: string
                    example: "Error: [SQL query error message]"

  /update-notifications.php:
    post:
      summary: Updates user notification settings
      operationId: updateNotificationSettings
      tags:
        - USER MODULE
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                product_alert:
                  type: string
                  description: Enable/disable product alerts (1 or 0).
                  example: "1"
                in_app_notification:
                  type: string
                  description: Enable/disable in-app notifications (1 or 0).
                  example: "0"
                general_notification:
                  type: string
                  description: Enable/disable general notifications (1 or 0).
                  example: "1"
                new_product:
                  type: string
                  description: Enable/disable new product notifications (1 or 0).
                  example: "1"
                favorite_store:
                  type: string
                  description: Enable/disable favorite store notifications (1 or 0).
                  example: "0"
                news_letter:
                  type: string
                  description: Enable/disable newsletter subscriptions (1 or 0).
                  example: "1"
      responses:
        200:
          description: Successfully updated notification settings
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Notification settings updated successfully."
                  data:
                    type: object
                    description: The updated notification settings for the user.
                    example:
                      user_id: 123
                      product_alert: 1
                      in_app_notification: 0
                      general_notification: 1
                      new_product: 1
                      favorite_store: 0
                      news_letter: 1
        400:
          description: Bad Request - Invalid or missing parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "No valid notification data provided."
        404:
          description: Not Found - User not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "User not found."
        500:
          description: Internal Server Error - Could not process the request
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "An error occurred."
                  error:
                    type: string
                    example: "Error: [SQL query error message]"

  /user-settings.php:
    get:
      summary: Get user settings
      description: Fetch user settings and account details for a given user ID.
      operationId: getUserSettings
      tags:
        - USER MODULE
      responses:
        200:
          description: User settings fetched successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Get settings"
                  data:
                    type: object
                    properties:
                      language:
                        type: object
                        properties:
                          language:
                            type: string
                            example: "English"
                      location:
                        type: object
                        properties:
                          latlong:
                            type: string
                            example: "37.7749,-122.4194"
                      notification:
                        type: object
                        properties:
                          product_alert:
                            type: integer
                            example: 1
                          in_app_notification:
                            type: integer
                            example: 1
                          general_notification:
                            type: integer
                            example: 1
                          new_product:
                            type: integer
                            example: 1
                          favorite_store:
                            type: integer
                            example: 0
                          news_letter:
                            type: integer
                            example: 1
                      account_setting:
                        type: object
                        properties:
                          mid:
                            type: integer
                            example: 123
                          username:
                            type: string
                            example: "johndoe"
                          email:
                            type: string
                            example: "john@example.com"
                          preferences:
                            type: array
                            items:
                              type: object
                              properties:
                                ctid:
                                  type: integer
                                  example: 1
                                name:
                                  type: string
                                  example: "Electronics"
        400:
          description: Bad Request - User ID is missing or invalid
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "User ID is required."
                  data:
                    type: array
                    example: []
        404:
          description: User settings not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Settings not found for the given user ID."
                  data:
                    type: array
                    example: []
        500:
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "An error occurred while processing your request."
                  data:
                    type: array
                    example: []


  /preference-update.php:
    post:
      summary: Update user preferences
      description: Updates the preferences for a given user by adding new category IDs.
      operationId: updatePreference
      tags:
        - "USER MODULE"
      requestBody:
        description: User preference update details
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                cid:
                  type: integer
                  description: Comma-separated list of category IDs to add to the user's preferences.
                  example: "3,5,8,1"
      responses:
        '200':
          description: Preference updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Preference Updated Successfully"
                  data:
                    type: object
                    properties:
                      mid:
                        type: integer
                        example: 1
                      preference:
                        type: integer
                        example: "3,1,8,5"
        '400':
          description: Missing required fields or invalid input
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Category ID is required."
        '404':
          description: User not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "User not found."
        '500':
          description: Server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error: Database error message"

  /update-profile-img.php:
    post:
      summary: Upload a user's profile image
      description: Uploads a profile image for the authenticated user and replaces the old one if available.
      operationId: uploadProfileImage
      tags:
        - "USER MODULE"
      requestBody:
        description: Profile image upload details
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                image:
                  type: string
                  format: binary
                  description: The image file to upload (only JPG, JPEG, PNG allowed, max size 2MB)
      responses:
        '200':
          description: Profile image uploaded and updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Profile image updated successfully."
                  photo_url:
                    type: string
                    example: "uploads/profiles/profile_1734089710_cbcd4330.png"
        '400':
          description: Missing required fields or invalid input
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "File is required."
        '401':
          description: Unauthorized or invalid user ID
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Unauthorized or invalid user ID."
        '415':
          description: Unsupported media type (only JPG, JPEG, PNG files are allowed)
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Invalid file type. Only JPG, JPEG, and PNG allowed."
        '413':
          description: Payload too large (file exceeds the 2MB limit)
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "File size must be less than 2MB."
        '500':
          description: Server error during upload
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Error: Database error message or file upload error."

  /sub-subcategory-select-all.php:
    post:
      summary: Fetch Sub-Subcategories
      description: >
        Fetch all sub-subcategories, or filter by a specific subcategory ID (`sid`) 
        and/or category ID (`cid`). If no parameters are provided, all data is returned.
      tags:
        - CATEGORY & SUBCATEGORY MODULE
      parameters:
        - name: sid
          in: query
          description: Subcategory ID to filter the sub-subcategories.
          required: false
          schema:
            type: string
        - name: cid
          in: query
          description: Category ID to filter the sub-subcategories.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Successful response with sub-subcategories data or a message.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Indicates if the request was successful.
                  message:
                    type: string
                    description: Informational message.
                  data:
                    type: array
                    description: Array of sub-subcategory data.
                    items:
                      type: object
                      properties:
                        # Here, you can define the properties of the sub-subcategory inline
                        id:
                          type: integer
                          example: 1
                        name:
                          type: string
                          example: "Example SubSubCategory"
                        description:
                          type: string
                          example: "This is a sub-subcategory"
        '400':
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Invalid query parameter."
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Server error occurred."

  /update-auth-token.php:
    post:
      summary: Update access token
      description: Updates access token.
      tags:
        - "USER MODULE"
      responses:
        '401':
          description: Token updated successfully or invalid user ID.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "Token updated successfully."
                  data:
                    type: object
                    properties:
                      access_token:
                        type: string
                        example: "a1b2c3d4e5f67890abcdef1234567890"
        '400':
          description: Missing or invalid Authorization header.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Authorization header is required."
        '500':
          description: Failed to update token due to a server error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "Failed to update token. Error: Database Error"

  /validate-data.php:
    post:
      summary: Validate user profile (email or phone or password)
      tags:
        - "USER MODULE"
      operationId: validateData
      parameters:
        - name: type
          in: query
          required: true
          schema:
            type: string
            enum: [email, phone, password]
            description: The type of field to update (email or phone or password).
        - name: current
          in: query
          required: true
          schema:
            type: string
            description: The current value of the field to be updated.
        - name: new
          in: query
          required: true
          schema:
            type: string
            description: The new value to update the field to.
      responses:
        '200':
          description: "[type] is validated"
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: "[type] is validated"
                  data:
                    type: object
        '400':
          description: Bad request due to missing or invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "All fields are required."
        '404':
          description: User not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: "User not found."
  
  /user-feedback.php:
      post:
        summary: Submit user feedback
        tags:
          - "USER MODULE"
        operationId: addFeedback
        parameters:
          - name: rating
            in: query
            required: true
            schema:
              type: integer
              description: Add rating number between 1 to 10.
          - name: description
            in: query
            required: true
            schema:
              type: string
              description: Enter feedback description.
        responses:
          '200':
            description: Feedback submitted successfully.
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    success:
                      type: boolean
                      example: true
                    message:
                      type: string
                      example: "Feedback submitted successfully."
                    data:
                      type: array
                      example: [] 
  /test-push-notification.php:
      post:
        summary: Test push notification
        tags:
          - "MISCELLANEOUS MODULE"
        operationId: testnotification
        parameters:
          - name: title
            in: query
            required: true
            schema:
              type: string
              description: Add title of notification
          - name: description
            in: query
            required: true
            schema:
              type: string
              description: Enter body of message.
        responses:
          '200':
            description: Notification sent successfully.
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    success:
                      type: boolean
                      example: true
                    message:
                      type: string
                      example: "Notification sent successfully."
                    data:
                      type: array
                      example: []                    
