openapi: 3.0.3
info:
  title: Hafeez Center Inventory API
  description: |
    Production-ready REST API for Hafeez Center Inventory Management System.
    
    ## Authentication
    This API uses token-based authentication via Laravel Sanctum. All protected endpoints require a Bearer token in the Authorization header.
    
    ## Getting Started
    1. Login using the `/api/v1/login` endpoint to receive an access token
    2. Include the token in the Authorization header: `Authorization: Bearer {token}`
    3. Use the token for all protected endpoints
    
    ## Token Expiration
    Tokens expire after 24 hours by default. This can be configured via the `SANCTUM_TOKEN_EXPIRATION` environment variable.
    
  version: 1.0.0
  contact:
    name: API Support
    email: aqeel@muhammadaqeel.com

servers:
  - url: https://ebizlogx.com/products/inventory-management/public/api/v1
    description: Production Server

tags:
  - name: Authentication
    description: User authentication and token management
  - name: Shops
    description: Shop management operations
  - name: Users
    description: User management operations
  - name: Customers
    description: Customer and vendor management operations
  - name: Items
    description: Product/Item inventory management operations
  - name: Brands
    description: Brand management operations
  - name: Categories
    description: Category management operations

paths:
  /login:
    post:
      tags:
        - Authentication
      summary: User login
      description: Authenticate user and receive access token
      operationId: login
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginRequest'
            example:
              email: user@example.com
              password: password123
      responses:
        '200':
          description: Login successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginResponse'
              example:
                success: true
                message: Login successful
                data:
                  user:
                    id: 1
                    name: John Doe
                    email: user@example.com
                    user_type: admin
                    shop_id: 1
                  access_token: 1|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                  token_type: Bearer
        '401':
          description: Invalid credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                message: Invalid credentials
                errors:
                  email:
                    - The provided credentials are incorrect.
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'

  /me:
    get:
      tags:
        - Authentication
      summary: Get authenticated user
      description: Retrieve information about the currently authenticated user
      operationId: getMe
      security:
        - bearerAuth: []
      responses:
        '200':
          description: User information retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MeResponse'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'

  /logout:
    post:
      tags:
        - Authentication
      summary: Logout current device
      description: Revoke the current access token
      operationId: logout
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Logged out successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogoutResponse'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'

  /logout-all:
    post:
      tags:
        - Authentication
      summary: Logout all devices
      description: Revoke all access tokens for the authenticated user
      operationId: logoutAll
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Logged out from all devices successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogoutResponse'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'

  /shops:
    get:
      tags:
        - Shops
      summary: List shops
      description: Retrieve a paginated list of shops. Only shows shops created by the authenticated user.
      operationId: listShops
      security:
        - bearerAuth: []
      parameters:
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            default: 15
            minimum: 1
            maximum: 100
        - name: status
          in: query
          description: Filter by status
          required: false
          schema:
            type: string
            enum: [Active, Inactive]
        - name: search
          in: query
          description: Search in title, owner_name, contact_no, address
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Shops retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShopListResponse'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'

    post:
      tags:
        - Shops
      summary: Create shop
      description: Create a new shop
      operationId: createShop
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ShopRequest'
            example:
              title: New Shop
              address: 456 Oak Ave
              owner_name: Jane Smith
              contact_no: 9876543210
              status: Active
      responses:
        '201':
          description: Shop created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShopResponse'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'

  /shops/{id}:
    get:
      tags:
        - Shops
      summary: Get shop
      description: Retrieve a specific shop by ID. Only accessible if the shop belongs to the authenticated user.
      operationId: getShop
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          description: Shop ID
          schema:
            type: integer
      responses:
        '200':
          description: Shop retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShopResponse'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Unauthorized access
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Shop not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'

    patch:
      tags:
        - Shops
      summary: Update shop
      description: Update an existing shop. You can send all fields or only the fields you want to update. Only accessible if the shop belongs to the authenticated user.
      operationId: updateShop
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          description: Shop ID
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ShopRequest'
            example:
              title: Updated Shop Name
              address: 789 Pine St
              owner_name: Jane Smith
              contact_no: 9876543210
              status: Active
            examples:
              fullUpdate:
                summary: Full update example
                value:
                  title: Updated Shop Name
                  address: 789 Pine St
                  owner_name: Jane Smith
                  contact_no: 9876543210
                  status: Active
              partialUpdate:
                summary: Partial update example
                value:
                  title: Partially Updated Shop Name
      responses:
        '200':
          description: Shop updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShopResponse'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Unauthorized access
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Shop not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'

    delete:
      tags:
        - Shops
      summary: Delete shop
      description: Delete a shop (soft delete). Only accessible if the shop belongs to the authenticated user.
      operationId: deleteShop
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          description: Shop ID
          schema:
            type: integer
      responses:
        '200':
          description: Shop deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteResponse'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Unauthorized access
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Shop not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'

  /users:
    get:
      tags:
        - Users
      summary: List users
      description: Retrieve a paginated list of users. Only shows users created by the authenticated user.
      operationId: listUsers
      security:
        - bearerAuth: []
      parameters:
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            default: 15
        - name: shop_id
          in: query
          description: Filter by shop ID
          required: false
          schema:
            type: integer
        - name: status
          in: query
          description: Filter by status
          required: false
          schema:
            type: string
            enum: [Active, Inactive]
        - name: user_type
          in: query
          description: Filter by user type
          required: false
          schema:
            type: string
            enum: [admin, user]
        - name: search
          in: query
          description: Search in name, email, contact_no
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Users retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserListResponse'
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'

    post:
      tags:
        - Users
      summary: Create user
      description: Create a new user
      operationId: createUser
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserRequest'
      responses:
        '201':
          description: User created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserResponse'
        '401':
          description: Unauthenticated
        '422':
          description: Validation error

  /users/{id}:
    get:
      tags:
        - Users
      summary: Get user
      description: Retrieve a specific user by ID. Only accessible if the user was created by the authenticated user.
      operationId: getUser
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: User retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserResponse'
        '401':
          description: Unauthenticated
        '403':
          description: Unauthorized access
        '404':
          description: User not found

    patch:
      tags:
        - Users
      summary: Update user
      description: Update an existing user. Only accessible if the user was created by the authenticated user.
      operationId: updateUser
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserRequest'
      responses:
        '200':
          description: User updated successfully
        '401':
          description: Unauthenticated
        '403':
          description: Unauthorized access
        '404':
          description: User not found
        '422':
          description: Validation error

    delete:
      tags:
        - Users
      summary: Delete user
      description: Delete a user. Only accessible if the user was created by the authenticated user.
      operationId: deleteUser
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: User deleted successfully
        '401':
          description: Unauthenticated
        '403':
          description: Unauthorized access
        '404':
          description: User not found

  /customers:
    get:
      tags:
        - Customers
      summary: List customers
      description: Retrieve a paginated list of customers. Only shows customers from shops created by the authenticated user.
      operationId: listCustomers
      security:
        - bearerAuth: []
      parameters:
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            default: 15
        - name: shop_id
          in: query
          description: Filter by shop ID
          required: false
          schema:
            type: integer
        - name: status
          in: query
          description: Filter by status
          required: false
          schema:
            type: string
            enum: [Active, Inactive]
        - name: type
          in: query
          description: Filter by type
          required: false
          schema:
            type: string
            enum: [walk-in, shop]
        - name: vendor_type
          in: query
          description: Filter by vendor type
          required: false
          schema:
            type: string
            enum: [customer, vendor, both]
        - name: search
          in: query
          description: Search in name, contact_number, id_card, address
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Customers retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerListResponse'
        '401':
          description: Unauthenticated

    post:
      tags:
        - Customers
      summary: Create customer
      description: Create a new customer
      operationId: createCustomer
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerRequest'
      responses:
        '201':
          description: Customer created successfully
        '401':
          description: Unauthenticated
        '422':
          description: Validation error

  /customers/{id}:
    get:
      tags:
        - Customers
      summary: Get customer
      description: Retrieve a specific customer by ID. Only accessible if the customer belongs to a shop created by the authenticated user.
      operationId: getCustomer
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Customer retrieved successfully
        '401':
          description: Unauthenticated
        '403':
          description: Unauthorized access
        '404':
          description: Customer not found

    patch:
      tags:
        - Customers
      summary: Update customer
      description: Update an existing customer. Only accessible if the customer belongs to a shop created by the authenticated user.
      operationId: updateCustomer
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerRequest'
      responses:
        '200':
          description: Customer updated successfully
        '401':
          description: Unauthenticated
        '403':
          description: Unauthorized access
        '404':
          description: Customer not found
        '422':
          description: Validation error

    delete:
      tags:
        - Customers
      summary: Delete customer
      description: Delete a customer. Only accessible if the customer belongs to a shop created by the authenticated user.
      operationId: deleteCustomer
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Customer deleted successfully
        '401':
          description: Unauthenticated
        '403':
          description: Unauthorized access
        '404':
          description: Customer not found

  /items:
    get:
      tags:
        - Items
      summary: List items
      description: Retrieve a paginated list of items. Only shows items from shops created by the authenticated user.
      operationId: listItems
      security:
        - bearerAuth: []
      parameters:
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            default: 15
        - name: shop_id
          in: query
          description: Filter by shop ID
          required: false
          schema:
            type: integer
        - name: cat_id
          in: query
          description: Filter by category ID
          required: false
          schema:
            type: integer
        - name: brand_id
          in: query
          description: Filter by brand ID
          required: false
          schema:
            type: integer
        - name: status
          in: query
          description: Filter by status
          required: false
          schema:
            type: string
            enum: [Active, Inactive]
        - name: condition
          in: query
          description: Filter by condition
          required: false
          schema:
            type: string
            enum: [New, Used, Used Rough]
        - name: search
          in: query
          description: Search in title, color, ram, memory, registration_type, sim_status, imei, serial_number, brand name
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Items retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ItemListResponse'
        '401':
          description: Unauthenticated

    post:
      tags:
        - Items
      summary: Create item
      description: Create a new item
      operationId: createItem
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ItemRequest'
      responses:
        '201':
          description: Item created successfully
        '401':
          description: Unauthenticated
        '422':
          description: Validation error

  /items/{id}:
    get:
      tags:
        - Items
      summary: Get item
      description: Retrieve a specific item by ID. Only accessible if the item belongs to a shop created by the authenticated user.
      operationId: getItem
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Item retrieved successfully
        '401':
          description: Unauthenticated
        '403':
          description: Unauthorized access
        '404':
          description: Item not found

    patch:
      tags:
        - Items
      summary: Update item
      description: Update an existing item. Only accessible if the item belongs to a shop created by the authenticated user.
      operationId: updateItem
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ItemRequest'
      responses:
        '200':
          description: Item updated successfully
        '401':
          description: Unauthenticated
        '403':
          description: Unauthorized access
        '404':
          description: Item not found
        '422':
          description: Validation error

    delete:
      tags:
        - Items
      summary: Delete item
      description: Delete an item. Only accessible if the item belongs to a shop created by the authenticated user.
      operationId: deleteItem
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Item deleted successfully
        '401':
          description: Unauthenticated
        '403':
          description: Unauthorized access
        '404':
          description: Item not found

  /brands:
    get:
      tags:
        - Brands
      summary: List brands
      description: Retrieve a paginated list of brands
      operationId: listBrands
      security:
        - bearerAuth: []
      parameters:
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            default: 15
        - name: cat_id
          in: query
          description: Filter by category ID
          required: false
          schema:
            type: integer
        - name: status
          in: query
          description: Filter by status
          required: false
          schema:
            type: string
            enum: [Active, Inactive]
        - name: search
          in: query
          description: Search in name, status, category name
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Brands retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BrandListResponse'
        '401':
          description: Unauthenticated

    post:
      tags:
        - Brands
      summary: Create brand
      description: Create a new brand
      operationId: createBrand
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BrandRequest'
      responses:
        '201':
          description: Brand created successfully
        '401':
          description: Unauthenticated
        '422':
          description: Validation error

  /brands/{id}:
    get:
      tags:
        - Brands
      summary: Get brand
      description: Retrieve a specific brand by ID
      operationId: getBrand
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Brand retrieved successfully
        '401':
          description: Unauthenticated
        '404':
          description: Brand not found

    patch:
      tags:
        - Brands
      summary: Update brand
      description: Update an existing brand
      operationId: updateBrand
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BrandRequest'
      responses:
        '200':
          description: Brand updated successfully
        '401':
          description: Unauthenticated
        '404':
          description: Brand not found
        '422':
          description: Validation error

    delete:
      tags:
        - Brands
      summary: Delete brand
      description: Delete a brand
      operationId: deleteBrand
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Brand deleted successfully
        '401':
          description: Unauthenticated
        '404':
          description: Brand not found

  /categories:
    get:
      tags:
        - Categories
      summary: List categories
      description: Retrieve a paginated list of categories
      operationId: listCategories
      security:
        - bearerAuth: []
      parameters:
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            default: 15
        - name: status
          in: query
          description: Filter by status
          required: false
          schema:
            type: string
            enum: [Active, Inactive]
        - name: search
          in: query
          description: Search in name, code
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Categories retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CategoryListResponse'
        '401':
          description: Unauthenticated

    post:
      tags:
        - Categories
      summary: Create category
      description: Create a new category
      operationId: createCategory
      security:
        - bearerAuth: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CategoryRequest'
      responses:
        '201':
          description: Category created successfully
        '401':
          description: Unauthenticated
        '422':
          description: Validation error

  /categories/{id}:
    get:
      tags:
        - Categories
      summary: Get category
      description: Retrieve a specific category by ID
      operationId: getCategory
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Category retrieved successfully
        '401':
          description: Unauthenticated
        '404':
          description: Category not found

    patch:
      tags:
        - Categories
      summary: Update category
      description: Update an existing category
      operationId: updateCategory
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CategoryRequest'
      responses:
        '200':
          description: Category updated successfully
        '401':
          description: Unauthenticated
        '404':
          description: Category not found
        '422':
          description: Validation error

    delete:
      tags:
        - Categories
      summary: Delete category
      description: Delete a category
      operationId: deleteCategory
      security:
        - bearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        '200':
          description: Category deleted successfully
        '401':
          description: Unauthenticated
        '404':
          description: Category not found

components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Enter the token received from the login endpoint

  schemas:
    LoginRequest:
      type: object
      required:
        - email
        - password
      properties:
        email:
          type: string
          format: email
          example: user@example.com
        password:
          type: string
          format: password
          example: password123

    LoginResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Login successful
        data:
          type: object
          properties:
            user:
              $ref: '#/components/schemas/User'
            access_token:
              type: string
              example: 1|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            token_type:
              type: string
              example: Bearer

    MeResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: User retrieved successfully
        data:
          type: object
          properties:
            user:
              $ref: '#/components/schemas/UserDetail'

    LogoutResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Logged out successfully

    ShopRequest:
      type: object
      required:
        - title
        - owner_name
        - contact_no
        - status
      properties:
        title:
          type: string
          maxLength: 150
          example: New Shop
        address:
          type: string
          nullable: true
          example: 456 Oak Ave
        owner_name:
          type: string
          maxLength: 150
          example: Jane Smith
        contact_no:
          type: string
          maxLength: 25
          example: 9876543210
        status:
          type: string
          enum: [Active, Inactive]
          example: Active

    Shop:
      type: object
      properties:
        id:
          type: integer
          example: 1
        title:
          type: string
          example: Main Shop
        address:
          type: string
          nullable: true
          example: 123 Main St
        owner_name:
          type: string
          example: John Doe
        contact_no:
          type: string
          example: 1234567890
        status:
          type: string
          enum: [Active, Inactive]
          example: Active
        user_id:
          type: integer
          example: 1
        created_at:
          type: string
          format: date-time
          example: 2025-12-04T10:00:00.000000Z
        updated_at:
          type: string
          format: date-time
          example: 2025-12-04T10:00:00.000000Z

    ShopResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Shop created successfully
        data:
          $ref: '#/components/schemas/Shop'

    ShopListResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Shops retrieved successfully
        data:
          type: array
          items:
            $ref: '#/components/schemas/Shop'
        meta:
          type: object
          properties:
            current_page:
              type: integer
              example: 1
            per_page:
              type: integer
              example: 15
            total:
              type: integer
              example: 1
            last_page:
              type: integer
              example: 1

    DeleteResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Shop deleted successfully

    UserDetail:
      allOf:
        - $ref: '#/components/schemas/User'
        - type: object
          properties:
            contact_no:
              type: string
              nullable: true
              example: 1234567890
            status:
              type: string
              enum: [Active, Inactive]
              example: Active
            shop:
              type: object
              nullable: true
              properties:
                id:
                  type: integer
                  example: 1
                title:
                  type: string
                  example: Main Shop
                owner_name:
                  type: string
                  example: John Doe

    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          example: Error message
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          example:
            field_name:
              - Error message for this field

    ValidationErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        message:
          type: string
          example: Validation failed
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          example:
            title:
              - The shop title is required.
            owner_name:
              - The owner name is required.

    UserRequest:
      type: object
      required:
        - shop_id
        - name
        - email
        - password
        - password_confirmation
        - user_type
        - status
      properties:
        shop_id:
          type: integer
          example: 1
        name:
          type: string
          maxLength: 255
          example: John Doe
        email:
          type: string
          format: email
          example: john@example.com
        password:
          type: string
          format: password
          example: password123
        password_confirmation:
          type: string
          format: password
          example: password123
        contact_no:
          type: string
          maxLength: 25
          nullable: true
          example: 1234567890
        user_type:
          type: string
          enum: [admin, user]
          example: admin
        status:
          type: string
          enum: [Active, Inactive]
          example: Active

    User:
      type: object
      properties:
        id:
          type: integer
          example: 1
        name:
          type: string
          example: John Doe
        email:
          type: string
          format: email
          example: john@example.com
        shop_id:
          type: integer
          nullable: true
          example: 1
        contact_no:
          type: string
          nullable: true
          example: 1234567890
        user_type:
          type: string
          enum: [sadmin, admin, user]
          example: admin
        status:
          type: string
          enum: [Active, Inactive]
          example: Active
        created_by:
          type: integer
          example: 1
        shop:
          type: object
          nullable: true
          properties:
            id:
              type: integer
            title:
              type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time

    UserResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: User created successfully
        data:
          $ref: '#/components/schemas/User'

    UserListResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Users retrieved successfully
        data:
          type: array
          items:
            $ref: '#/components/schemas/User'
        meta:
          type: object
          properties:
            current_page:
              type: integer
            per_page:
              type: integer
            total:
              type: integer
            last_page:
              type: integer

    CustomerRequest:
      type: object
      required:
        - name
        - type
        - vendor_type
        - status
      properties:
        name:
          type: string
          maxLength: 150
          example: Customer Name
        type:
          type: string
          enum: [walk-in, shop]
          example: walk-in
        vendor_type:
          type: string
          enum: [customer, vendor, both]
          example: customer
        id_card:
          type: string
          maxLength: 25
          nullable: true
          example: 12345-1234567-1
        contact_number:
          type: string
          maxLength: 25
          nullable: true
          example: 1234567890
        address:
          type: string
          nullable: true
          example: 123 Main St
        op_balance:
          type: number
          format: decimal
          nullable: true
          example: 1000.00
        op_balance_date:
          type: string
          format: date
          nullable: true
          example: 2025-12-04
        shop_id:
          type: integer
          nullable: true
          example: 1
        status:
          type: string
          enum: [Active, Inactive]
          example: Active

    Customer:
      type: object
      properties:
        id:
          type: integer
          example: 1
        name:
          type: string
          example: Customer Name
        type:
          type: string
          example: walk-in
        vendor_type:
          type: string
          example: customer
        id_card:
          type: string
          nullable: true
          example: 12345-1234567-1
        contact_number:
          type: string
          nullable: true
          example: 1234567890
        address:
          type: string
          nullable: true
          example: 123 Main St
        op_balance:
          type: number
          format: decimal
          nullable: true
          example: 1000.00
        op_balance_date:
          type: string
          format: date
          nullable: true
          example: 2025-12-04
        shop_id:
          type: integer
          nullable: true
          example: 1
        status:
          type: string
          enum: [Active, Inactive]
          example: Active
        shop:
          type: object
          nullable: true
          properties:
            id:
              type: integer
            title:
              type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time

    CustomerResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Customer created successfully
        data:
          $ref: '#/components/schemas/Customer'

    CustomerListResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Customers retrieved successfully
        data:
          type: array
          items:
            $ref: '#/components/schemas/Customer'
        meta:
          type: object
          properties:
            current_page:
              type: integer
            per_page:
              type: integer
            total:
              type: integer
            last_page:
              type: integer

    ItemRequest:
      type: object
      required:
        - cat_id
        - brand_id
        - title
        - condition
        - status
      properties:
        shop_id:
          type: integer
          nullable: true
          example: 1
        cat_id:
          type: integer
          example: 1
        brand_id:
          type: integer
          example: 1
        title:
          type: string
          maxLength: 250
          example: iPhone 15 Pro Max
        description:
          type: string
          nullable: true
          example: Latest iPhone model
        ram:
          type: string
          maxLength: 100
          nullable: true
          example: 8GB
        memory:
          type: string
          maxLength: 100
          nullable: true
          example: 256GB
        color:
          type: string
          maxLength: 50
          nullable: true
          example: Blue Titanium
        registration_type:
          type: string
          enum: [Non PTA, PTA, CPID, JV]
          nullable: true
          example: PTA
        sim_status:
          type: string
          enum: [Single, Dual Physical, Dual + eSim, eSim Dual]
          nullable: true
          example: Dual Physical
        imei_1:
          type: string
          maxLength: 100
          nullable: true
          example: 123456789012345
        imei_2:
          type: string
          maxLength: 100
          nullable: true
          example: 123456789012346
        serial_number:
          type: string
          maxLength: 100
          nullable: true
          example: SN123456789
        condition:
          type: string
          enum: [New, Used, Used Rough]
          example: New
        status:
          type: string
          enum: [Active, Inactive]
          example: Active

    Item:
      type: object
      properties:
        id:
          type: integer
          example: 1
        shop_id:
          type: integer
          nullable: true
          example: 1
        cat_id:
          type: integer
          example: 1
        brand_id:
          type: integer
          example: 1
        title:
          type: string
          example: iPhone 15 Pro Max
        description:
          type: string
          nullable: true
        ram:
          type: string
          nullable: true
        memory:
          type: string
          nullable: true
        color:
          type: string
          nullable: true
        registration_type:
          type: string
          nullable: true
        sim_status:
          type: string
          nullable: true
        imei_1:
          type: string
          nullable: true
        imei_2:
          type: string
          nullable: true
        serial_number:
          type: string
          nullable: true
        condition:
          type: string
          example: New
        status:
          type: string
          enum: [Active, Inactive]
          example: Active
        brand:
          type: object
          nullable: true
          properties:
            id:
              type: integer
            name:
              type: string
        category:
          type: object
          nullable: true
          properties:
            id:
              type: integer
            name:
              type: string
        shop:
          type: object
          nullable: true
          properties:
            id:
              type: integer
            title:
              type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time

    ItemResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Item created successfully
        data:
          $ref: '#/components/schemas/Item'

    ItemListResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Items retrieved successfully
        data:
          type: array
          items:
            $ref: '#/components/schemas/Item'
        meta:
          type: object
          properties:
            current_page:
              type: integer
            per_page:
              type: integer
            total:
              type: integer
            last_page:
              type: integer

    BrandRequest:
      type: object
      required:
        - name
        - cat_id
        - status
      properties:
        name:
          type: string
          maxLength: 150
          example: Apple
        cat_id:
          type: integer
          example: 1
        status:
          type: string
          enum: [Active, Inactive]
          example: Active

    Brand:
      type: object
      properties:
        id:
          type: integer
          example: 1
        name:
          type: string
          example: Apple
        cat_id:
          type: integer
          example: 1
        status:
          type: string
          enum: [Active, Inactive]
          example: Active
        category:
          type: object
          nullable: true
          properties:
            id:
              type: integer
            name:
              type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time

    BrandResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Brand created successfully
        data:
          $ref: '#/components/schemas/Brand'

    BrandListResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Brands retrieved successfully
        data:
          type: array
          items:
            $ref: '#/components/schemas/Brand'
        meta:
          type: object
          properties:
            current_page:
              type: integer
            per_page:
              type: integer
            total:
              type: integer
            last_page:
              type: integer

    CategoryRequest:
      type: object
      required:
        - name
        - status
      properties:
        name:
          type: string
          maxLength: 255
          example: Mobile Phones
        code:
          type: string
          maxLength: 255
          nullable: true
          example: MOB
        status:
          type: string
          enum: [Active, Inactive]
          example: Active

    Category:
      type: object
      properties:
        id:
          type: integer
          example: 1
        name:
          type: string
          example: Mobile Phones
        code:
          type: string
          nullable: true
          example: MOB
        status:
          type: string
          enum: [Active, Inactive]
          example: Active
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time

    CategoryResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Category created successfully
        data:
          $ref: '#/components/schemas/Category'

    CategoryListResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Categories retrieved successfully
        data:
          type: array
          items:
            $ref: '#/components/schemas/Category'
        meta:
          type: object
          properties:
            current_page:
              type: integer
            per_page:
              type: integer
            total:
              type: integer
            last_page:
              type: integer

