openapi: 3.0.0
info:
  title: Repzo API Collection
  description: Complete API documentation for Repzo platform
  version: 1.0.0
servers:
  - url: https://api.repzo.me/v1
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /activity-ai-sales-order:
    get:
      tags:
        - Activity AI Sales Order
      summary: Get all AI sales order activities
      description: >-
        Retrieve a list of all AI sales order activities with optional filtering
        and pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of AI sales order activities retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ActivityAiSalesOrder"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - Activity AI Sales Order
      summary: Create a new AI sales order activity
      description: Create a new AI sales order activity with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ActivityAiSalesOrderInput"
      responses:
        "201":
          description: AI sales order activity created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ActivityAiSalesOrder"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /activity-ai-sales-order/{id}:
    get:
      tags:
        - Activity AI Sales Order
      summary: Get AI sales order activity by ID
      description: Retrieve a specific AI sales order activity by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: AI sales order activity ID
          schema:
            type: string
      responses:
        "200":
          description: AI sales order activity retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ActivityAiSalesOrder"
        "401":
          description: Unauthorized
        "404":
          description: AI sales order activity not found
        "500":
          description: Internal server error
    put:
      tags:
        - Activity AI Sales Order
      summary: Update AI sales order activity
      description: Update an existing AI sales order activity with new data
      parameters:
        - name: id
          in: path
          required: true
          description: AI sales order activity ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ActivityAiSalesOrderInput"
      responses:
        "200":
          description: AI sales order activity updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ActivityAiSalesOrder"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: AI sales order activity not found
        "500":
          description: Internal server error
    delete:
      tags:
        - Activity AI Sales Order
      summary: Delete AI sales order activity
      description: Delete an existing AI sales order activity
      parameters:
        - name: id
          in: path
          required: true
          description: AI sales order activity ID
          schema:
            type: string
      responses:
        "200":
          description: AI sales order activity deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: AI sales order activity deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: AI sales order activity not found
        "500":
          description: Internal server error
  /activity-ai-sales-order/{id}/generate:
    post:
      tags:
        - Activity AI Sales Order
      summary: Generate AI recommendations
      description: Generate AI-powered sales order recommendations for the activity
      parameters:
        - name: id
          in: path
          required: true
          description: AI sales order activity ID
          schema:
            type: string
      responses:
        "200":
          description: AI recommendations generated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      recommendations:
                        type: array
                        items:
                          type: object
                          properties:
                            product:
                              type: string
                            quantity:
                              type: integer
                            confidence:
                              type: number
                              format: double
                            reason:
                              type: string
        "401":
          description: Unauthorized
        "404":
          description: AI sales order activity not found
        "500":
          description: Internal server error
  /activity-feedback-v2:
    get:
      tags:
        - Activity Feedback V2
      summary: Get all activity feedback v2
      description: >-
        Retrieve a list of all activity feedback v2 with optional filtering and
        pagination
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          description: Sort field
          required: false
          schema:
            type: string
        - name: company_namespace
          in: query
          description: Company namespace for filtering
          required: false
          schema:
            type: array
            items:
              type: string
        - name: activity_type
          in: query
          description: Filter by activity type
          required: false
          schema:
            type: string
        - name: rep
          in: query
          description: Filter by representative ID
          required: false
          schema:
            type: string
        - name: client
          in: query
          description: Filter by client ID
          required: false
          schema:
            type: string
        - name: overall_satisfaction
          in: query
          description: Filter by overall satisfaction rating
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 10
        - name: template_id
          in: query
          description: Filter by feedback template ID
          required: false
          schema:
            type: string
        - name: _id
          in: query
          description: Filter by ID
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ActivityFeedbackV2"
                  paging:
                    $ref: "#/components/schemas/PagingInfo"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
    post:
      tags:
        - Activity Feedback V2
      summary: Create new activity feedback v2
      description: Create a new activity feedback v2 entry
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateActivityFeedbackV2Request"
      responses:
        "201":
          description: Activity feedback v2 created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ActivityFeedbackV2"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /activity-feedback-v2/{id}:
    get:
      tags:
        - Activity Feedback V2
      summary: Get activity feedback v2 by ID
      description: Retrieve a specific activity feedback v2 by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Activity feedback v2 ID
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ActivityFeedbackV2"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    patch:
      tags:
        - Activity Feedback V2
      summary: Update activity feedback v2
      description: Update an existing activity feedback v2
      parameters:
        - name: id
          in: path
          required: true
          description: Activity feedback v2 ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateActivityFeedbackV2Request"
      responses:
        "200":
          description: Activity feedback v2 updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ActivityFeedbackV2"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
    delete:
      tags:
        - Activity Feedback V2
      summary: Delete activity feedback v2
      description: Delete an activity feedback v2 by ID
      parameters:
        - name: id
          in: path
          required: true
          description: Activity feedback v2 ID
          schema:
            type: string
      responses:
        "200":
          description: Activity feedback v2 deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /activity-feedback-v2/analytics/detailed:
    get:
      tags:
        - Activity Feedback V2
      summary: Get detailed feedback analytics
      description: Get detailed analytics and insights for activity feedback v2
      parameters:
        - name: date_from
          in: query
          description: Start date for analytics
          required: false
          schema:
            type: string
            format: date
        - name: date_to
          in: query
          description: End date for analytics
          required: false
          schema:
            type: string
            format: date
        - name: activity_type
          in: query
          description: Filter by activity type
          required: false
          schema:
            type: string
        - name: rep
          in: query
          description: Filter by representative ID
          required: false
          schema:
            type: string
        - name: template_id
          in: query
          description: Filter by feedback template ID
          required: false
          schema:
            type: string
      responses:
        "200":
          description: Detailed analytics data retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      summary:
                        type: object
                        properties:
                          total_feedback:
                            type: integer
                          average_satisfaction:
                            type: number
                            format: float
                          response_rate:
                            type: number
                            format: float
                      satisfaction_trends:
                        type: array
                        items:
                          type: object
                          properties:
                            date:
                              type: string
                              format: date
                            average_satisfaction:
                              type: number
                              format: float
                            count:
                              type: integer
                      question_analysis:
                        type: array
                        items:
                          type: object
                          properties:
                            question_id:
                              type: string
                            question_text:
                              type: string
                            average_score:
                              type: number
                              format: float
                            response_count:
                              type: integer
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /activity-feedback:
    get:
      tags:
        - Activity Feedback
      summary: Get all activity feedback
      description: >-
        Retrieve a list of all activity feedback with optional filtering and
        pagination
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          description: Sort field
          required: false
          schema:
            type: string
        - name: company_namespace
          in: query
          description: Company namespace for filtering
          required: false
          schema:
            type: array
            items:
              type: string
        - name: activity_type
          in: query
          description: Filter by activity type
          required: false
          schema:
            type: string
        - name: rep
          in: query
          description: Filter by representative ID
          required: false
          schema:
            type: string
        - name: client
          in: query
          description: Filter by client ID
          required: false
          schema:
            type: string
        - name: rating
          in: query
          description: Filter by rating
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 5
        - name: _id
          in: query
          description: Filter by ID
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ActivityFeedback"
                  paging:
                    $ref: "#/components/schemas/PagingInfo"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
    post:
      tags:
        - Activity Feedback
      summary: Create new activity feedback
      description: Create a new activity feedback entry
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateActivityFeedbackRequest"
      responses:
        "201":
          description: Activity feedback created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ActivityFeedback"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /activity-feedback/{id}:
    get:
      tags:
        - Activity Feedback
      summary: Get activity feedback by ID
      description: Retrieve a specific activity feedback by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Activity feedback ID
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ActivityFeedback"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    patch:
      tags:
        - Activity Feedback
      summary: Update activity feedback
      description: Update an existing activity feedback
      parameters:
        - name: id
          in: path
          required: true
          description: Activity feedback ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateActivityFeedbackRequest"
      responses:
        "200":
          description: Activity feedback updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ActivityFeedback"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
    delete:
      tags:
        - Activity Feedback
      summary: Delete activity feedback
      description: Delete an activity feedback by ID
      parameters:
        - name: id
          in: path
          required: true
          description: Activity feedback ID
          schema:
            type: string
      responses:
        "200":
          description: Activity feedback deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /activity-feedback/analytics:
    get:
      tags:
        - Activity Feedback
      summary: Get feedback analytics
      description: Get analytics and statistics for activity feedback
      parameters:
        - name: date_from
          in: query
          description: Start date for analytics
          required: false
          schema:
            type: string
            format: date
        - name: date_to
          in: query
          description: End date for analytics
          required: false
          schema:
            type: string
            format: date
        - name: activity_type
          in: query
          description: Filter by activity type
          required: false
          schema:
            type: string
        - name: rep
          in: query
          description: Filter by representative ID
          required: false
          schema:
            type: string
      responses:
        "200":
          description: Analytics data retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      total_feedback:
                        type: integer
                        description: Total feedback count
                      average_rating:
                        type: number
                        format: float
                        description: Average rating
                      rating_distribution:
                        type: object
                        properties:
                          "1":
                            type: integer
                          "2":
                            type: integer
                          "3":
                            type: integer
                          "4":
                            type: integer
                          "5":
                            type: integer
                      by_activity_type:
                        type: object
                        additionalProperties:
                          type: object
                          properties:
                            count:
                              type: integer
                            average_rating:
                              type: number
                              format: float
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /activity-storecheck:
    get:
      tags:
        - Activity Storecheck
      summary: Get all activity storecheck records
      description: >-
        Retrieve a list of all activity storecheck records with optional
        filtering and pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of activity storecheck records retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ActivityStorecheck"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - Activity Storecheck
      summary: Create a new activity storecheck record
      description: Create a new activity storecheck record with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ActivityStorecheckInput"
      responses:
        "201":
          description: Activity storecheck record created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ActivityStorecheck"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /activity-storecheck/{id}:
    get:
      tags:
        - Activity Storecheck
      summary: Get activity storecheck record by ID
      description: Retrieve a specific activity storecheck record by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Activity storecheck record ID
          schema:
            type: string
      responses:
        "200":
          description: Activity storecheck record retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ActivityStorecheck"
        "401":
          description: Unauthorized
        "404":
          description: Activity storecheck record not found
        "500":
          description: Internal server error
    put:
      tags:
        - Activity Storecheck
      summary: Update activity storecheck record
      description: Update an existing activity storecheck record with new data
      parameters:
        - name: id
          in: path
          required: true
          description: Activity storecheck record ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ActivityStorecheckInput"
      responses:
        "200":
          description: Activity storecheck record updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ActivityStorecheck"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: Activity storecheck record not found
        "500":
          description: Internal server error
    delete:
      tags:
        - Activity Storecheck
      summary: Delete activity storecheck record
      description: Delete an existing activity storecheck record
      parameters:
        - name: id
          in: path
          required: true
          description: Activity storecheck record ID
          schema:
            type: string
      responses:
        "200":
          description: Activity storecheck record deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Activity storecheck record deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: Activity storecheck record not found
        "500":
          description: Internal server error
  /adjust-account:
    get:
      summary: Find account adjustments
      operationId: findAccountAdjustments
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              client:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              rep:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              type:
                type: string
                enum:
                  - credit
                  - debit
              from_date:
                type: string
                format: date-time
              to_date:
                type: string
                format: date-time
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                        - createdAt
                        - updatedAt
                        - amount
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering account adjustments
      responses:
        "200":
          description: A list of account adjustments
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AdjustAccountFindResult"
    post:
      summary: Create an account adjustment
      operationId: createAccountAdjustment
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AdjustAccountCreateBody"
      responses:
        "201":
          description: Account adjustment created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AdjustAccountCreateResult"
  /adjust-account/{id}:
    get:
      summary: Get an account adjustment by ID
      operationId: getAccountAdjustment
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Account adjustment details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AdjustAccountGetResult"
  /adjust-inventory:
    get:
      summary: Find inventory adjustments
      operationId: findInventoryAdjustments
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering inventory adjustments
      responses:
        "200":
          description: A list of inventory adjustments
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InventoryAdjustmentFindResult"
    post:
      summary: Create an inventory adjustment
      operationId: createInventoryAdjustment
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/InventoryAdjustmentCreateBody"
      responses:
        "201":
          description: Inventory adjustment created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InventoryAdjustmentCreateResult"
  /adjust-inventory/{id}:
    get:
      summary: Get an inventory adjustment by ID
      operationId: getInventoryAdjustment
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Inventory adjustment details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InventoryAdjustmentGetResult"
  /approval-request:
    get:
      summary: Find approval requests
      operationId: findApprovalRequests
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering approval requests
      responses:
        "200":
          description: A list of approval requests
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApprovalRequestFindResult"
    post:
      summary: Create an approval request
      operationId: createApprovalRequest
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ApprovalRequestCreateBody"
      responses:
        "201":
          description: Approval request created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApprovalRequestCreateResult"
  /approval-request/{id}:
    get:
      summary: Get an approval request by ID
      operationId: getApprovalRequest
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Approval request details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApprovalRequestGetResult"
    put:
      summary: Update an approval request
      operationId: updateApprovalRequest
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ApprovalRequestUpdateBody"
      responses:
        "200":
          description: Approval request updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApprovalRequestUpdateResult"
    delete:
      summary: Remove an approval request
      operationId: removeApprovalRequest
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Approval request removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApprovalRequestRemoveResult"
  /approvals:
    get:
      summary: Find approvals
      operationId: findApprovals
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering approvals
      responses:
        "200":
          description: A list of approvals
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApprovalFindResult"
    post:
      summary: Create an approval
      operationId: createApproval
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ApprovalCreateBody"
      responses:
        "201":
          description: Approval created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApprovalCreateResult"
  /approvals/{id}:
    get:
      summary: Get an approval by ID
      operationId: getApproval
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Approval details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApprovalGetResult"
    put:
      summary: Update an approval
      operationId: updateApproval
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ApprovalUpdateBody"
      responses:
        "200":
          description: Approval updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApprovalUpdateResult"
    delete:
      summary: Remove an approval
      operationId: removeApproval
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Approval removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApprovalRemoveResult"
  /asset-part-receival:
    get:
      tags:
        - Asset Part Receival
      summary: Get all asset part receivals
      description: >-
        Retrieve a list of all asset part receivals with optional filtering and
        pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of asset part receivals retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/AssetPartReceival"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - Asset Part Receival
      summary: Create a new asset part receival
      description: Create a new asset part receival with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetPartReceivalInput"
      responses:
        "201":
          description: Asset part receival created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetPartReceival"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /asset-part-receival/{id}:
    get:
      tags:
        - Asset Part Receival
      summary: Get asset part receival by ID
      description: Retrieve a specific asset part receival by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part receival ID
          schema:
            type: string
      responses:
        "200":
          description: Asset part receival retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetPartReceival"
        "401":
          description: Unauthorized
        "404":
          description: Asset part receival not found
        "500":
          description: Internal server error
    put:
      tags:
        - Asset Part Receival
      summary: Update asset part receival
      description: Update an existing asset part receival with new data
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part receival ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetPartReceivalInput"
      responses:
        "200":
          description: Asset part receival updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetPartReceival"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: Asset part receival not found
        "500":
          description: Internal server error
    delete:
      tags:
        - Asset Part Receival
      summary: Delete asset part receival
      description: Delete an existing asset part receival
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part receival ID
          schema:
            type: string
      responses:
        "200":
          description: Asset part receival deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Asset part receival deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: Asset part receival not found
        "500":
          description: Internal server error
  /asset-part-transfer:
    get:
      tags:
        - Asset Part Transfer
      summary: Get all asset part transfers
      description: >-
        Retrieve a list of all asset part transfers with optional filtering and
        pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of asset part transfers retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/AssetPartTransfer"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - Asset Part Transfer
      summary: Create a new asset part transfer
      description: Create a new asset part transfer with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetPartTransferInput"
      responses:
        "201":
          description: Asset part transfer created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetPartTransfer"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /asset-part-transfer/{id}:
    get:
      tags:
        - Asset Part Transfer
      summary: Get asset part transfer by ID
      description: Retrieve a specific asset part transfer by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part transfer ID
          schema:
            type: string
      responses:
        "200":
          description: Asset part transfer retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetPartTransfer"
        "401":
          description: Unauthorized
        "404":
          description: Asset part transfer not found
        "500":
          description: Internal server error
    put:
      tags:
        - Asset Part Transfer
      summary: Update asset part transfer
      description: Update an existing asset part transfer with new data
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part transfer ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetPartTransferInput"
      responses:
        "200":
          description: Asset part transfer updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetPartTransfer"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: Asset part transfer not found
        "500":
          description: Internal server error
    delete:
      tags:
        - Asset Part Transfer
      summary: Delete asset part transfer
      description: Delete an existing asset part transfer
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part transfer ID
          schema:
            type: string
      responses:
        "200":
          description: Asset part transfer deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Asset part transfer deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: Asset part transfer not found
        "500":
          description: Internal server error
  /asset-part-transfer/{id}/complete:
    post:
      tags:
        - Asset Part Transfer
      summary: Complete asset part transfer
      description: Mark an asset part transfer as completed
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part transfer ID
          schema:
            type: string
      responses:
        "200":
          description: Asset part transfer completed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetPartTransfer"
        "401":
          description: Unauthorized
        "404":
          description: Asset part transfer not found
        "500":
          description: Internal server error
  /asset-part-type:
    get:
      tags:
        - Asset Part Type
      summary: Get all asset part types
      description: >-
        Retrieve a list of all asset part types with optional filtering and
        pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of asset part types retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/AssetPartType"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - Asset Part Type
      summary: Create a new asset part type
      description: Create a new asset part type with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetPartTypeInput"
      responses:
        "201":
          description: Asset part type created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetPartType"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /asset-part-type/{id}:
    get:
      tags:
        - Asset Part Type
      summary: Get asset part type by ID
      description: Retrieve a specific asset part type by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part type ID
          schema:
            type: string
      responses:
        "200":
          description: Asset part type retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetPartType"
        "401":
          description: Unauthorized
        "404":
          description: Asset part type not found
        "500":
          description: Internal server error
    put:
      tags:
        - Asset Part Type
      summary: Update asset part type
      description: Update an existing asset part type with new data
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part type ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetPartTypeInput"
      responses:
        "200":
          description: Asset part type updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetPartType"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: Asset part type not found
        "500":
          description: Internal server error
    delete:
      tags:
        - Asset Part Type
      summary: Delete asset part type
      description: Delete an existing asset part type
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part type ID
          schema:
            type: string
      responses:
        "200":
          description: Asset part type deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Asset part type deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: Asset part type not found
        "500":
          description: Internal server error
  /asset-part-unit:
    get:
      tags:
        - Asset Part Unit
      summary: Get all asset part units
      description: >-
        Retrieve a list of all asset part units with optional filtering and
        pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of asset part units retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/AssetPartUnit"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - Asset Part Unit
      summary: Create a new asset part unit
      description: Create a new asset part unit with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetPartUnitInput"
      responses:
        "201":
          description: Asset part unit created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetPartUnit"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /asset-part-unit/{id}:
    get:
      tags:
        - Asset Part Unit
      summary: Get asset part unit by ID
      description: Retrieve a specific asset part unit by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part unit ID
          schema:
            type: string
      responses:
        "200":
          description: Asset part unit retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetPartUnit"
        "401":
          description: Unauthorized
        "404":
          description: Asset part unit not found
        "500":
          description: Internal server error
    put:
      tags:
        - Asset Part Unit
      summary: Update asset part unit
      description: Update an existing asset part unit with new data
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part unit ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetPartUnitInput"
      responses:
        "200":
          description: Asset part unit updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetPartUnit"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: Asset part unit not found
        "500":
          description: Internal server error
    delete:
      tags:
        - Asset Part Unit
      summary: Delete asset part unit
      description: Delete an existing asset part unit
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part unit ID
          schema:
            type: string
      responses:
        "200":
          description: Asset part unit deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Asset part unit deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: Asset part unit not found
        "500":
          description: Internal server error
  /asset-part:
    get:
      tags:
        - Asset Part
      summary: Get all asset parts
      description: >-
        Retrieve a list of all asset parts with optional filtering and
        pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of asset parts retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/AssetPart"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - Asset Part
      summary: Create a new asset part
      description: Create a new asset part with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetPartInput"
      responses:
        "201":
          description: Asset part created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetPart"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /asset-part/{id}:
    get:
      tags:
        - Asset Part
      summary: Get asset part by ID
      description: Retrieve a specific asset part by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part ID
          schema:
            type: string
      responses:
        "200":
          description: Asset part retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetPart"
        "401":
          description: Unauthorized
        "404":
          description: Asset part not found
        "500":
          description: Internal server error
    put:
      tags:
        - Asset Part
      summary: Update asset part
      description: Update an existing asset part with new data
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetPartInput"
      responses:
        "200":
          description: Asset part updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetPart"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: Asset part not found
        "500":
          description: Internal server error
    delete:
      tags:
        - Asset Part
      summary: Delete asset part
      description: Delete an existing asset part
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part ID
          schema:
            type: string
      responses:
        "200":
          description: Asset part deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Asset part deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: Asset part not found
        "500":
          description: Internal server error
  /asset-type:
    get:
      summary: Find asset types
      operationId: findAssetTypes
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering asset types
      responses:
        "200":
          description: A list of asset types
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetTypeFindResult"
    post:
      summary: Create an asset type
      operationId: createAssetType
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetTypeCreateBody"
      responses:
        "201":
          description: Asset type created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetTypeCreateResult"
  /asset-type/{id}:
    get:
      summary: Get an asset type by ID
      operationId: getAssetType
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Asset type details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetTypeGetResult"
    put:
      summary: Update an asset type
      operationId: updateAssetType
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetTypeUpdateBody"
      responses:
        "200":
          description: Asset type updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetTypeUpdateResult"
    delete:
      summary: Remove an asset type
      operationId: removeAssetType
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Asset type removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetTypeRemoveResult"
  /asset-unit:
    get:
      tags:
        - Asset Unit
      summary: Get all asset units
      description: >-
        Retrieve a list of all asset units with optional filtering and
        pagination
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          description: Sort field
          required: false
          schema:
            type: string
        - name: company_namespace
          in: query
          description: Company namespace for filtering
          required: false
          schema:
            type: array
            items:
              type: string
        - name: asset
          in: query
          description: Filter by asset ID
          required: false
          schema:
            type: string
        - name: status
          in: query
          description: Filter by status
          required: false
          schema:
            type: string
            enum:
              - active
              - maintenance
              - retired
              - disposed
        - name: location
          in: query
          description: Filter by location
          required: false
          schema:
            type: string
        - name: _id
          in: query
          description: Filter by ID
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/AssetUnit"
                  paging:
                    $ref: "#/components/schemas/PagingInfo"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
    post:
      tags:
        - Asset Unit
      summary: Create a new asset unit
      description: Create a new asset unit entry
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateAssetUnitRequest"
      responses:
        "201":
          description: Asset unit created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetUnit"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /asset-unit/{id}:
    get:
      tags:
        - Asset Unit
      summary: Get asset unit by ID
      description: Retrieve a specific asset unit by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Asset unit ID
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetUnit"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    patch:
      tags:
        - Asset Unit
      summary: Update asset unit
      description: Update an existing asset unit
      parameters:
        - name: id
          in: path
          required: true
          description: Asset unit ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateAssetUnitRequest"
      responses:
        "200":
          description: Asset unit updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetUnit"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
    delete:
      tags:
        - Asset Unit
      summary: Delete asset unit
      description: Delete an asset unit by ID
      parameters:
        - name: id
          in: path
          required: true
          description: Asset unit ID
          schema:
            type: string
      responses:
        "200":
          description: Asset unit deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /asset-unit/remove:
    post:
      tags:
        - Asset Unit
      summary: Bulk delete asset units
      description: Delete multiple asset units by their IDs
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                ids:
                  type: array
                  items:
                    type: string
                  description: Array of asset unit IDs to delete
              required:
                - ids
      responses:
        "200":
          description: Asset units deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /asset-unit/{id}/status:
    patch:
      tags:
        - Asset Unit
      summary: Update asset unit status
      description: Update the status of an asset unit
      parameters:
        - name: id
          in: path
          required: true
          description: Asset unit ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                  enum:
                    - active
                    - maintenance
                    - retired
                    - disposed
                  description: New status for the asset unit
                reason:
                  type: string
                  description: Reason for status change
                notes:
                  type: string
                  description: Additional notes
              required:
                - status
      responses:
        "200":
          description: Asset unit status updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/AssetUnit"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /asset:
    get:
      summary: Find assets
      operationId: findAssets
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering assets
      responses:
        "200":
          description: A list of assets
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetFindResult"
    post:
      summary: Create an asset
      operationId: createAsset
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetCreateBody"
      responses:
        "201":
          description: Asset created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetCreateResult"
  /asset/{id}:
    get:
      summary: Get an asset by ID
      operationId: getAsset
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Asset details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetGetResult"
    put:
      summary: Update an asset
      operationId: updateAsset
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AssetUpdateBody"
      responses:
        "200":
          description: Asset updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetUpdateResult"
    delete:
      summary: Remove an asset
      operationId: removeAsset
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Asset removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetRemoveResult"
  /banks:
    get:
      summary: Find banks
      operationId: findBanks
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering banks
      responses:
        "200":
          description: A list of banks
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankFindResult"
    post:
      summary: Create a bank
      operationId: createBank
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BankCreateBody"
      responses:
        "201":
          description: Bank created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankCreateResult"
  /banks/{id}:
    get:
      summary: Get a bank by ID
      operationId: getBank
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Bank details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankGetResult"
    put:
      summary: Update a bank
      operationId: updateBank
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BankUpdateBody"
      responses:
        "200":
          description: Bank updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankUpdateResult"
    delete:
      summary: Remove a bank
      operationId: removeBank
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Bank removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankRemoveResult"
  /bankslists:
    get:
      summary: Find bank lists
      operationId: findBankLists
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering bank lists
      responses:
        "200":
          description: A list of bank lists
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankListFindResult"
    post:
      summary: Create a bank list
      operationId: createBankList
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BankListCreateBody"
      responses:
        "201":
          description: Bank list created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankListCreateResult"
  /bankslists/{id}:
    get:
      summary: Get a bank list by ID
      operationId: getBankList
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Bank list details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankListGetResult"
    put:
      summary: Update a bank list
      operationId: updateBankList
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BankListUpdateBody"
      responses:
        "200":
          description: Bank list updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankListUpdateResult"
    delete:
      summary: Remove a bank list
      operationId: removeBankList
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Bank list removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankListRemoveResult"
  /product-brand:
    get:
      summary: Find brands
      operationId: findBrands
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering brands
      responses:
        "200":
          description: A list of brands
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BrandFindResult"
    post:
      summary: Create a brand
      operationId: createBrand
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BrandCreateBody"
      responses:
        "201":
          description: Brand created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BrandCreateResult"
  /product-brand/{id}:
    get:
      summary: Get a brand by ID
      operationId: getBrand
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Brand details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BrandGetResult"
    put:
      summary: Update a brand
      operationId: updateBrand
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BrandUpdateBody"
      responses:
        "200":
          description: Brand updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BrandUpdateResult"
    delete:
      summary: Remove a brand
      operationId: removeBrand
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Brand removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BrandRemoveResult"
  /product-category:
    get:
      summary: Find categories
      operationId: findCategories
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering categories
      responses:
        "200":
          description: A list of categories
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CategoryFindResult"
    post:
      summary: Create a category
      operationId: createCategory
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CategoryCreateBody"
      responses:
        "201":
          description: Category created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CategoryCreateResult"
  /product-category/{id}:
    get:
      summary: Get a category by ID
      operationId: getCategory
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Category details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CategoryGetResult"
    put:
      summary: Update a category
      operationId: updateCategory
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CategoryUpdateBody"
      responses:
        "200":
          description: Category updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CategoryUpdateResult"
    delete:
      summary: Remove a category
      operationId: removeCategory
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Category removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CategoryRemoveResult"
  /checks:
    get:
      summary: Find checks
      operationId: findChecks
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              client:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              rep:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              checkNumber:
                type: string
              status:
                type: string
                enum:
                  - pending
                  - cleared
                  - bounced
                  - cancelled
              bank:
                type: string
              from_date:
                type: string
                format: date-time
              to_date:
                type: string
                format: date-time
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                        - createdAt
                        - updatedAt
                        - amount
                        - dueDate
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering checks
      responses:
        "200":
          description: A list of checks
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CheckFindResult"
    post:
      summary: Create a check
      operationId: createCheck
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CheckCreateBody"
      responses:
        "201":
          description: Check created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CheckCreateResult"
  /checks/{id}:
    get:
      summary: Get a check by ID
      operationId: getCheck
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Check details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CheckGetResult"
  /client-channel:
    get:
      tags:
        - Channel
      summary: Get all client channels
      description: >-
        Retrieve a list of all client channels with optional filtering and
        pagination
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          description: Sort field
          required: false
          schema:
            type: string
        - name: _id
          in: query
          description: Filter by channel ID(s)
          required: false
          schema:
            oneOf:
              - type: string
              - type: array
                items:
                  type: string
        - name: search
          in: query
          description: Search text for channel name
          required: false
          schema:
            type: string
        - name: name
          in: query
          description: Filter by channel name(s)
          required: false
          schema:
            oneOf:
              - type: string
              - type: array
                items:
                  type: string
        - name: local_name
          in: query
          description: Filter by local name(s)
          required: false
          schema:
            oneOf:
              - type: string
              - type: array
                items:
                  type: string
        - name: disabled
          in: query
          description: Filter by disabled status
          required: false
          schema:
            type: boolean
        - name: from_updatedAt
          in: query
          description: Filter channels updated after this timestamp
          required: false
          schema:
            type: integer
            format: int64
        - name: from__id
          in: query
          description: Filter channels with ID greater than this value
          required: false
          schema:
            type: string
        - name: to__id
          in: query
          description: Filter channels with ID less than this value
          required: false
          schema:
            type: string
        - name: sortBy
          in: query
          description: Advanced sorting options
          required: false
          schema:
            type: array
            items:
              type: object
              properties:
                field:
                  type: string
                  enum:
                    - _id
                type:
                  type: string
                  enum:
                    - asc
                    - desc
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ChannelSchema"
                  pagination:
                    $ref: "#/components/schemas/PaginationResult"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "500":
          $ref: "#/components/responses/InternalServerError"
    post:
      tags:
        - Channel
      summary: Create a new client channel
      description: Create a new client channel
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ChannelCreateBody"
      responses:
        "201":
          description: Channel created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ChannelSchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /client-channel/{id}:
    get:
      tags:
        - Channel
      summary: Get a specific client channel
      description: Retrieve a specific client channel by ID
      parameters:
        - name: id
          in: path
          description: Channel ID
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ChannelSchema"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    put:
      tags:
        - Channel
      summary: Update a client channel
      description: Update an existing client channel
      parameters:
        - name: id
          in: path
          description: Channel ID
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ChannelUpdateBody"
      responses:
        "200":
          description: Channel updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ChannelSchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    delete:
      tags:
        - Channel
      summary: Delete a client channel
      description: Delete an existing client channel
      parameters:
        - name: id
          in: path
          description: Channel ID
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Channel deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ChannelSchema"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /client-contact:
    get:
      tags:
        - Client Contact
      summary: Get all client contacts
      description: >-
        Retrieve a list of all client contacts with optional filtering and
        pagination
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          description: Sort field
          required: false
          schema:
            type: string
        - name: _id
          in: query
          description: Filter by contact ID(s)
          required: false
          schema:
            oneOf:
              - type: string
              - type: array
                items:
                  type: string
        - name: search
          in: query
          description: Search text for contact name
          required: false
          schema:
            type: string
        - name: name
          in: query
          description: Filter by contact name(s)
          required: false
          schema:
            oneOf:
              - type: string
              - type: array
                items:
                  type: string
        - name: from_updatedAt
          in: query
          description: Filter contacts updated after this timestamp
          required: false
          schema:
            type: integer
            format: int64
        - name: to_updatedAt
          in: query
          description: Filter contacts updated before this timestamp
          required: false
          schema:
            type: integer
            format: int64
        - name: from__id
          in: query
          description: Filter contacts with ID greater than this value
          required: false
          schema:
            type: string
        - name: to__id
          in: query
          description: Filter contacts with ID less than this value
          required: false
          schema:
            type: string
        - name: sortBy
          in: query
          description: Advanced sorting options
          required: false
          schema:
            type: array
            items:
              type: object
              properties:
                field:
                  type: string
                  enum:
                    - _id
                type:
                  type: string
                  enum:
                    - asc
                    - desc
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ClientContactSchema"
                  pagination:
                    $ref: "#/components/schemas/PaginationResult"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "500":
          $ref: "#/components/responses/InternalServerError"
    post:
      tags:
        - Client Contact
      summary: Create a new client contact
      description: Create a new client contact
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ClientContactCreateBody"
      responses:
        "201":
          description: Client contact created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ClientContactSchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /client-contact/{id}:
    get:
      tags:
        - Client Contact
      summary: Get a specific client contact
      description: Retrieve a specific client contact by ID
      parameters:
        - name: id
          in: path
          description: Client contact ID
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ClientContactSchema"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    put:
      tags:
        - Client Contact
      summary: Update a client contact
      description: Update an existing client contact
      parameters:
        - name: id
          in: path
          description: Client contact ID
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ClientContactUpdateBody"
      responses:
        "200":
          description: Client contact updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ClientContactSchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    delete:
      tags:
        - Client Contact
      summary: Delete a client contact
      description: Delete an existing client contact
      parameters:
        - name: id
          in: path
          description: Client contact ID
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Client contact deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ClientContactSchema"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /client-location:
    get:
      tags:
        - Client Location
      summary: Get all client locations
      description: >-
        Retrieve a list of all client locations with optional filtering and
        pagination
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          description: Sort field
          required: false
          schema:
            type: string
        - name: company_namespace
          in: query
          description: Company namespace for filtering
          required: false
          schema:
            type: array
            items:
              type: string
        - name: client
          in: query
          description: Filter by client ID
          required: false
          schema:
            type: string
        - name: disabled
          in: query
          description: Filter by disabled status
          required: false
          schema:
            type: boolean
        - name: _id
          in: query
          description: Filter by ID
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ClientLocation"
                  paging:
                    $ref: "#/components/schemas/PagingInfo"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
    post:
      tags:
        - Client Location
      summary: Create a new client location
      description: Create a new client location entry
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateClientLocationRequest"
      responses:
        "201":
          description: Client location created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ClientLocation"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /client-location/{id}:
    get:
      tags:
        - Client Location
      summary: Get client location by ID
      description: Retrieve a specific client location by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Client location ID
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ClientLocation"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    patch:
      tags:
        - Client Location
      summary: Update client location
      description: Update an existing client location
      parameters:
        - name: id
          in: path
          required: true
          description: Client location ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateClientLocationRequest"
      responses:
        "200":
          description: Client location updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ClientLocation"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
    delete:
      tags:
        - Client Location
      summary: Delete client location
      description: Delete a client location by ID
      parameters:
        - name: id
          in: path
          required: true
          description: Client location ID
          schema:
            type: string
      responses:
        "200":
          description: Client location deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /client-location/remove:
    post:
      tags:
        - Client Location
      summary: Bulk delete client locations
      description: Delete multiple client locations by their IDs
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                ids:
                  type: array
                  items:
                    type: string
                  description: Array of client location IDs to delete
              required:
                - ids
      responses:
        "200":
          description: Client locations deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /client:
    get:
      summary: Find clients
      operationId: findClients
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering clients
      responses:
        "200":
          description: A list of clients
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ClientFindResult"
    post:
      summary: Create a client
      operationId: createClient
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ClientCreateBody"
      responses:
        "201":
          description: Client created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ClientCreateResult"
  /client/{id}:
    get:
      summary: Get a client by ID
      operationId: getClient
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Client details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ClientGetResult"
    put:
      summary: Update a client
      operationId: updateClient
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ClientUpdateBody"
      responses:
        "200":
          description: Client updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ClientUpdateResult"
    delete:
      summary: Remove a client
      operationId: removeClient
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Client removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ClientRemoveResult"
  /contract-installment:
    get:
      tags:
        - Contract Installment
      summary: Get all contract installments
      description: >-
        Retrieve a list of all contract installments with optional filtering and
        pagination
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          description: Sort field
          required: false
          schema:
            type: string
        - name: company_namespace
          in: query
          description: Company namespace for filtering
          required: false
          schema:
            type: array
            items:
              type: string
        - name: contract
          in: query
          description: Filter by contract ID
          required: false
          schema:
            type: string
        - name: status
          in: query
          description: Filter by payment status
          required: false
          schema:
            type: string
            enum:
              - pending
              - paid
              - overdue
              - cancelled
        - name: due_date_from
          in: query
          description: Filter by due date from
          required: false
          schema:
            type: string
            format: date
        - name: due_date_to
          in: query
          description: Filter by due date to
          required: false
          schema:
            type: string
            format: date
        - name: _id
          in: query
          description: Filter by ID
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ContractInstallment"
                  paging:
                    $ref: "#/components/schemas/PagingInfo"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
    post:
      tags:
        - Contract Installment
      summary: Create a new contract installment
      description: Create a new contract installment
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateContractInstallmentRequest"
      responses:
        "201":
          description: Contract installment created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ContractInstallment"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /contract-installment/{id}:
    get:
      tags:
        - Contract Installment
      summary: Get contract installment by ID
      description: Retrieve a specific contract installment by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Contract installment ID
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ContractInstallment"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    patch:
      tags:
        - Contract Installment
      summary: Update contract installment
      description: Update an existing contract installment
      parameters:
        - name: id
          in: path
          required: true
          description: Contract installment ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateContractInstallmentRequest"
      responses:
        "200":
          description: Contract installment updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ContractInstallment"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
    delete:
      tags:
        - Contract Installment
      summary: Delete contract installment
      description: Delete a contract installment by ID
      parameters:
        - name: id
          in: path
          required: true
          description: Contract installment ID
          schema:
            type: string
      responses:
        "200":
          description: Contract installment deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /contract-installment/{id}/pay:
    post:
      tags:
        - Contract Installment
      summary: Mark installment as paid
      description: Mark a contract installment as paid
      parameters:
        - name: id
          in: path
          required: true
          description: Contract installment ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                payment_date:
                  type: string
                  format: date
                  description: Date of payment
                payment_amount:
                  type: number
                  format: float
                  description: Amount paid
                payment_method:
                  type: string
                  description: Payment method used
                  enum:
                    - cash
                    - check
                    - credit_card
                    - bank_transfer
                    - other
                payment_reference:
                  type: string
                  description: Payment reference number
                notes:
                  type: string
                  description: Payment notes
              required:
                - payment_date
                - payment_amount
      responses:
        "200":
          description: Installment marked as paid successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ContractInstallment"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /contract-installment/overdue:
    get:
      tags:
        - Contract Installment
      summary: Get overdue installments
      description: Get all overdue contract installments
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: days_overdue
          in: query
          description: Minimum days overdue
          required: false
          schema:
            type: integer
            minimum: 0
      responses:
        "200":
          description: Overdue installments retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      allOf:
                        - $ref: "#/components/schemas/ContractInstallment"
                        - type: object
                          properties:
                            days_overdue:
                              type: integer
                              description: Number of days overdue
                  paging:
                    $ref: "#/components/schemas/PagingInfo"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /contract:
    get:
      summary: Find contracts
      operationId: findContracts
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering contracts
      responses:
        "200":
          description: A list of contracts
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContractFindResult"
    post:
      summary: Create a contract
      operationId: createContract
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ContractCreateBody"
      responses:
        "201":
          description: Contract created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContractCreateResult"
  /contract/{id}:
    get:
      summary: Get a contract by ID
      operationId: getContract
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Contract details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContractGetResult"
    put:
      summary: Update a contract
      operationId: updateContract
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ContractUpdateBody"
      responses:
        "200":
          description: Contract updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContractUpdateResult"
    delete:
      summary: Remove a contract
      operationId: removeContract
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Contract removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContractRemoveResult"
  /custom-list-item:
    get:
      summary: Find custom list items
      operationId: findCustomListItems
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering custom list items
      responses:
        "200":
          description: A list of custom list items
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomListItemFindResult"
    post:
      summary: Create a custom list item
      operationId: createCustomListItem
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CustomListItemCreateBody"
      responses:
        "201":
          description: Custom list item created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomListItemCreateResult"
  /custom-list-item/{id}:
    get:
      summary: Get a custom list item by ID
      operationId: getCustomListItem
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Custom list item details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomListItemGetResult"
    put:
      summary: Update a custom list item
      operationId: updateCustomListItem
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CustomListItemUpdateBody"
      responses:
        "200":
          description: Custom list item updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomListItemUpdateResult"
    delete:
      summary: Remove a custom list item
      operationId: removeCustomListItem
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Custom list item removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomListItemRemoveResult"
  /custom-list:
    get:
      summary: Find custom lists
      operationId: findCustomLists
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering custom lists
      responses:
        "200":
          description: A list of custom lists
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomListFindResult"
    post:
      summary: Create a custom list
      operationId: createCustomList
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CustomListCreateBody"
      responses:
        "201":
          description: Custom list created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomListCreateResult"
  /custom-list/{id}:
    get:
      summary: Get a custom list by ID
      operationId: getCustomList
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Custom list details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomListGetResult"
    put:
      summary: Update a custom list
      operationId: updateCustomList
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CustomListUpdateBody"
      responses:
        "200":
          description: Custom list updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomListUpdateResult"
    delete:
      summary: Remove a custom list
      operationId: removeCustomList
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Custom list removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomListRemoveResult"
  /custom-status:
    get:
      summary: Find custom statuses
      operationId: findCustomStatuses
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering custom statuses
      responses:
        "200":
          description: A list of custom statuses
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomStatusFindResult"
    post:
      summary: Create a custom status
      operationId: createCustomStatus
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CustomStatusCreateBody"
      responses:
        "201":
          description: Custom status created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomStatusCreateResult"
  /custom-status/{id}:
    get:
      summary: Get a custom status by ID
      operationId: getCustomStatus
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Custom status details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomStatusGetResult"
    put:
      summary: Update a custom status
      operationId: updateCustomStatus
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CustomStatusUpdateBody"
      responses:
        "200":
          description: Custom status updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomStatusUpdateResult"
    delete:
      summary: Remove a custom status
      operationId: removeCustomStatus
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Custom status removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomStatusRemoveResult"
  /day:
    get:
      summary: Find days
      operationId: findDays
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              rep:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              date:
                type: string
                format: date
              status:
                type: string
                enum:
                  - open
                  - closed
                  - submitted
              from_date:
                type: string
                format: date
              to_date:
                type: string
                format: date
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                        - createdAt
                        - updatedAt
                        - date
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering days
      responses:
        "200":
          description: A list of days
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DayFindResult"
    post:
      summary: Create a day
      operationId: createDay
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DayCreateBody"
      responses:
        "201":
          description: Day created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DayCreateResult"
  /day/{id}:
    get:
      summary: Get a day by ID
      operationId: getDay
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Day details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DayGetResult"
  /feedback-options:
    get:
      tags:
        - Feedback Options
      summary: Get all feedback options
      description: >-
        Retrieve a list of all feedback options with optional filtering and
        pagination
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          description: Sort field
          required: false
          schema:
            type: string
        - name: company_namespace
          in: query
          description: Company namespace for filtering
          required: false
          schema:
            type: array
            items:
              type: string
        - name: category
          in: query
          description: Filter by category
          required: false
          schema:
            type: string
        - name: is_active
          in: query
          description: Filter by active status
          required: false
          schema:
            type: boolean
        - name: template_type
          in: query
          description: Filter by template type
          required: false
          schema:
            type: string
            enum:
              - survey
              - rating
              - nps
              - custom
        - name: _id
          in: query
          description: Filter by ID
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/FeedbackOptions"
                  paging:
                    $ref: "#/components/schemas/PagingInfo"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
    post:
      tags:
        - Feedback Options
      summary: Create new feedback options
      description: Create a new feedback options template
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateFeedbackOptionsRequest"
      responses:
        "201":
          description: Feedback options created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/FeedbackOptions"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /feedback-options/{id}:
    get:
      tags:
        - Feedback Options
      summary: Get feedback options by ID
      description: Retrieve a specific feedback options template by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Feedback options ID
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/FeedbackOptions"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    patch:
      tags:
        - Feedback Options
      summary: Update feedback options
      description: Update an existing feedback options template
      parameters:
        - name: id
          in: path
          required: true
          description: Feedback options ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateFeedbackOptionsRequest"
      responses:
        "200":
          description: Feedback options updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/FeedbackOptions"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
    delete:
      tags:
        - Feedback Options
      summary: Delete feedback options
      description: Delete a feedback options template by ID
      parameters:
        - name: id
          in: path
          required: true
          description: Feedback options ID
          schema:
            type: string
      responses:
        "200":
          description: Feedback options deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /feedback-options/{id}/preview:
    get:
      tags:
        - Feedback Options
      summary: Preview feedback template
      description: Get a preview of how the feedback template will appear
      parameters:
        - name: id
          in: path
          required: true
          description: Feedback options ID
          schema:
            type: string
      responses:
        "200":
          description: Template preview retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      template_html:
                        type: string
                        description: HTML preview of the template
                      estimated_completion_time:
                        type: integer
                        description: Estimated time to complete in seconds
                      question_count:
                        type: integer
                        description: Total number of questions
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /feedback-options/templates:
    get:
      tags:
        - Feedback Options
      summary: Get predefined templates
      description: Get a list of predefined feedback templates
      parameters:
        - name: category
          in: query
          description: Filter by category
          required: false
          schema:
            type: string
        - name: template_type
          in: query
          description: Filter by template type
          required: false
          schema:
            type: string
            enum:
              - survey
              - rating
              - nps
              - custom
      responses:
        "200":
          description: Predefined templates retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        template_id:
                          type: string
                        name:
                          type: string
                        description:
                          type: string
                        category:
                          type: string
                        template_type:
                          type: string
                        question_count:
                          type: integer
                        estimated_time:
                          type: integer
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /fullinvoices:
    get:
      summary: Find full invoices
      operationId: findFullInvoices
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering full invoices
      responses:
        "200":
          description: A list of full invoices
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FullInvoiceFindResult"
    post:
      summary: Create a full invoice
      operationId: createFullInvoice
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FullInvoiceCreateBody"
      responses:
        "201":
          description: Full invoice created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FullInvoiceCreateResult"
  /fullinvoices/{id}:
    get:
      summary: Get a full invoice by ID
      operationId: getFullInvoice
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Full invoice details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FullInvoiceGetResult"
    put:
      summary: Update a full invoice
      operationId: updateFullInvoice
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FullInvoiceUpdateBody"
      responses:
        "200":
          description: Full invoice updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FullInvoiceUpdateResult"
  /integration-action-log:
    get:
      tags:
        - Integration Action Log
      summary: Get all integration action log records
      description: >-
        Retrieve a list of all integration action log records with optional
        filtering and pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of integration action log records retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/IntegrationActionLog"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - Integration Action Log
      summary: Create a new integration action log record
      description: Create a new integration action log record with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/IntegrationActionLogInput"
      responses:
        "201":
          description: Integration action log record created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/IntegrationActionLog"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /integration-action-log/{id}:
    get:
      tags:
        - Integration Action Log
      summary: Get integration action log record by ID
      description: Retrieve a specific integration action log record by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Integration action log record ID
          schema:
            type: string
      responses:
        "200":
          description: Integration action log record retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/IntegrationActionLog"
        "401":
          description: Unauthorized
        "404":
          description: Integration action log record not found
        "500":
          description: Internal server error
    put:
      tags:
        - Integration Action Log
      summary: Update integration action log record
      description: Update an existing integration action log record with new data
      parameters:
        - name: id
          in: path
          required: true
          description: Integration action log record ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/IntegrationActionLogInput"
      responses:
        "200":
          description: Integration action log record updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/IntegrationActionLog"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: Integration action log record not found
        "500":
          description: Internal server error
    delete:
      tags:
        - Integration Action Log
      summary: Delete integration action log record
      description: Delete an existing integration action log record
      parameters:
        - name: id
          in: path
          required: true
          description: Integration action log record ID
          schema:
            type: string
      responses:
        "200":
          description: Integration action log record deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Integration action log record deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: Integration action log record not found
        "500":
          description: Internal server error
  /integration-app:
    get:
      summary: Find integration apps
      operationId: findIntegrationApps
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              name:
                type: string
              category:
                type: string
              status:
                type: string
                enum:
                  - active
                  - inactive
                  - pending
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                        - createdAt
                        - updatedAt
                        - name
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering integration apps
      responses:
        "200":
          description: A list of integration apps
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntegrationAppFindResult"
    post:
      summary: Create an integration app
      operationId: createIntegrationApp
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/IntegrationAppCreateBody"
      responses:
        "201":
          description: Integration app created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntegrationAppCreateResult"
  /integration-app/{id}:
    get:
      summary: Get an integration app by ID
      operationId: getIntegrationApp
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Integration app details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntegrationAppGetResult"
    put:
      summary: Update an integration app
      operationId: updateIntegrationApp
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/IntegrationAppUpdateBody"
      responses:
        "200":
          description: Integration app updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IntegrationAppUpdateResult"
  /integration-command-log:
    get:
      tags:
        - Integration Command Log
      summary: Get all integration command log records
      description: >-
        Retrieve a list of all integration command log records with optional
        filtering and pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of integration command log records retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/IntegrationCommandLog"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - Integration Command Log
      summary: Create a new integration command log record
      description: Create a new integration command log record with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/IntegrationCommandLogInput"
      responses:
        "201":
          description: Integration command log record created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/IntegrationCommandLog"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /integration-command-log/{id}:
    get:
      tags:
        - Integration Command Log
      summary: Get integration command log record by ID
      description: Retrieve a specific integration command log record by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Integration command log record ID
          schema:
            type: string
      responses:
        "200":
          description: Integration command log record retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/IntegrationCommandLog"
        "401":
          description: Unauthorized
        "404":
          description: Integration command log record not found
        "500":
          description: Internal server error
    put:
      tags:
        - Integration Command Log
      summary: Update integration command log record
      description: Update an existing integration command log record with new data
      parameters:
        - name: id
          in: path
          required: true
          description: Integration command log record ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/IntegrationCommandLogInput"
      responses:
        "200":
          description: Integration command log record updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/IntegrationCommandLog"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: Integration command log record not found
        "500":
          description: Internal server error
    delete:
      tags:
        - Integration Command Log
      summary: Delete integration command log record
      description: Delete an existing integration command log record
      parameters:
        - name: id
          in: path
          required: true
          description: Integration command log record ID
          schema:
            type: string
      responses:
        "200":
          description: Integration command log record deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Integration command log record deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: Integration command log record not found
        "500":
          description: Internal server error
  /inventory-adjustment-reason:
    get:
      summary: Find inventory adjustment reasons
      operationId: findInventoryAdjustmentReasons
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering inventory adjustment reasons
      responses:
        "200":
          description: A list of inventory adjustment reasons
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InventoryAdjustmentReasonFindResult"
    post:
      summary: Create an inventory adjustment reason
      operationId: createInventoryAdjustmentReason
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/InventoryAdjustmentReasonCreateBody"
      responses:
        "201":
          description: Inventory adjustment reason created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InventoryAdjustmentReasonCreateResult"
  /inventory-adjustment-reason/{id}:
    get:
      summary: Get an inventory adjustment reason by ID
      operationId: getInventoryAdjustmentReason
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Inventory adjustment reason details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InventoryAdjustmentReasonGetResult"
    put:
      summary: Update an inventory adjustment reason
      operationId: updateInventoryAdjustmentReason
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/InventoryAdjustmentReasonUpdateBody"
      responses:
        "200":
          description: Inventory adjustment reason updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InventoryAdjustmentReasonUpdateResult"
    delete:
      summary: Remove an inventory adjustment reason
      operationId: removeInventoryAdjustmentReason
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Inventory adjustment reason removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InventoryAdjustmentReasonRemoveResult"
  /inventory:
    get:
      summary: Find inventory items
      operationId: findInventory
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering inventory items
      responses:
        "200":
          description: A list of inventory items
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/InventoryFindResult"
  /mail-unsubscribe:
    get:
      tags:
        - Mail Unsubscribe
      summary: Get all unsubscribed emails
      description: >-
        Retrieve a list of all unsubscribed email addresses with optional
        filtering and pagination
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          description: Sort field
          required: false
          schema:
            type: string
        - name: email
          in: query
          description: Filter by email address
          required: false
          schema:
            type: string
        - name: company_namespace
          in: query
          description: Company namespace for filtering
          required: false
          schema:
            type: array
            items:
              type: string
        - name: _id
          in: query
          description: Filter by ID
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/MailUnsubscribe"
                  paging:
                    $ref: "#/components/schemas/PagingInfo"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
    post:
      tags:
        - Mail Unsubscribe
      summary: Add email to unsubscribe list
      description: Add an email address to the unsubscribe list
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateMailUnsubscribeRequest"
      responses:
        "201":
          description: Email unsubscribed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/MailUnsubscribe"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /mail-unsubscribe/{id}:
    get:
      tags:
        - Mail Unsubscribe
      summary: Get unsubscribe record by ID
      description: Retrieve a specific unsubscribe record by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Unsubscribe record ID
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/MailUnsubscribe"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    delete:
      tags:
        - Mail Unsubscribe
      summary: Remove email from unsubscribe list
      description: Remove an email address from the unsubscribe list (re-subscribe)
      parameters:
        - name: id
          in: path
          required: true
          description: Unsubscribe record ID
          schema:
            type: string
      responses:
        "200":
          description: Email re-subscribed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /mail-unsubscribe/remove:
    post:
      tags:
        - Mail Unsubscribe
      summary: Bulk remove emails from unsubscribe list
      description: Remove multiple email addresses from the unsubscribe list
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                ids:
                  type: array
                  items:
                    type: string
                  description: Array of unsubscribe record IDs to remove
              required:
                - ids
      responses:
        "200":
          description: Emails re-subscribed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /mail-unsubscribe/check:
    post:
      tags:
        - Mail Unsubscribe
      summary: Check if email is unsubscribed
      description: Check if an email address is in the unsubscribe list
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  format: email
                  description: Email address to check
              required:
                - email
      responses:
        "200":
          description: Check result
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      is_unsubscribed:
                        type: boolean
                        description: Whether the email is unsubscribed
                      unsubscribe_date:
                        type: string
                        format: date-time
                        description: Date when email was unsubscribed (if applicable)
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /measureunitfamily:
    get:
      summary: Find measure unit families
      operationId: findMeasureUnitFamilies
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              local_name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              disabled:
                type: boolean
              from_updatedAt:
                type: number
              measureunits:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              populatedKeys:
                type: array
                items:
                  type: string
                  enum:
                    - measureunits
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering measure unit families
      responses:
        "200":
          description: A list of measure unit families
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MeasureUnitFamilyFindResult"
    post:
      summary: Create a measure unit family
      operationId: createMeasureUnitFamily
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MeasureUnitFamilyCreateBody"
      responses:
        "201":
          description: Measure unit family created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MeasureUnitFamilyCreateResult"
  /measureunitfamily/{id}:
    get:
      summary: Get a measure unit family by ID
      operationId: getMeasureUnitFamily
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Measure unit family details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MeasureUnitFamilyGetResult"
    put:
      summary: Update a measure unit family
      operationId: updateMeasureUnitFamily
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MeasureUnitFamilyUpdateBody"
      responses:
        "200":
          description: Measure unit family updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MeasureUnitFamilyUpdateResult"
    delete:
      summary: Remove a measure unit family
      operationId: removeMeasureUnitFamily
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Measure unit family removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MeasureUnitFamilyRemoveResult"
  /measure-unit:
    get:
      summary: Find measure units
      operationId: findMeasureUnits
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              factor:
                oneOf:
                  - type: array
                    items:
                      type: number
                  - type: number
              parent:
                type: string
                enum:
                  - nil
              disabled:
                type: boolean
              from_updatedAt:
                type: number
              family_name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              withFamily:
                type: boolean
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering measure units
      responses:
        "200":
          description: A list of measure units
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MeasureUnitFindResult"
    post:
      summary: Create a measure unit
      operationId: createMeasureUnit
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MeasureUnitCreateBody"
      responses:
        "201":
          description: Measure unit created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MeasureUnitCreateResult"
  /measure-unit/{id}:
    get:
      summary: Get a measure unit by ID
      operationId: getMeasureUnit
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Measure unit details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MeasureUnitGetResult"
    put:
      summary: Update a measure unit
      operationId: updateMeasureUnit
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MeasureUnitUpdateBody"
      responses:
        "200":
          description: Measure unit updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MeasureUnitUpdateResult"
    delete:
      summary: Remove a measure unit
      operationId: removeMeasureUnit
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Measure unit removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MeasureUnitRemoveResult"
  /media-storage:
    get:
      summary: Find media storage items
      operationId: findMediaStorage
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              filename:
                type: string
              mimeType:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              category:
                type: string
              entityType:
                type: string
              entityId:
                type: string
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                        - createdAt
                        - updatedAt
                        - filename
                        - size
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering media storage items
      responses:
        "200":
          description: A list of media storage items
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MediaStorageFindResult"
    post:
      summary: Create a media storage item
      operationId: createMediaStorage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MediaStorageCreateBody"
      responses:
        "201":
          description: Media storage item created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MediaStorageCreateResult"
  /media-storage/{id}:
    get:
      summary: Get a media storage item by ID
      operationId: getMediaStorage
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Media storage item details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MediaStorageGetResult"
    put:
      summary: Update a media storage item
      operationId: updateMediaStorage
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MediaStorageUpdateBody"
      responses:
        "200":
          description: Media storage item updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MediaStorageUpdateResult"
    delete:
      summary: Remove a media storage item
      operationId: removeMediaStorage
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Media storage item removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MediaStorageRemoveResult"
  /media:
    get:
      summary: Find media
      operationId: findMedia
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              description:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              parent_document_key:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              url:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              disabled:
                type: boolean
              document_type:
                type: string
                enum:
                  - html
                  - csv
                  - json
                  - image
                  - pdf
                  - ppt
                  - pptx
                  - xls
                  - xlsx
                  - doc
                  - docx
                  - images
                  - zip
                  - pt
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering media
      responses:
        "200":
          description: A list of media
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MediaFindResult"
    post:
      summary: Create media
      operationId: createMedia
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MediaCreateBody"
      responses:
        "201":
          description: Media created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MediaCreateResult"
  /media/{id}:
    get:
      summary: Get media by ID
      operationId: getMedia
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Media details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MediaGetResult"
    put:
      summary: Update media
      operationId: updateMedia
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MediaUpdateBody"
      responses:
        "200":
          description: Media updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MediaUpdateResult"
    delete:
      summary: Remove media
      operationId: removeMedia
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Media removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MediaRemoveResult"
  /msl-products:
    get:
      summary: Find MSL products
      operationId: findMSLProducts
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering MSL products
      responses:
        "200":
          description: A list of MSL products
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MSLProductFindResult"
    post:
      summary: Create an MSL product
      operationId: createMSLProduct
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MSLProductCreateBody"
      responses:
        "201":
          description: MSL product created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MSLProductCreateResult"
  /msl-products/{id}:
    get:
      summary: Get an MSL product by ID
      operationId: getMSLProduct
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: MSL product details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MSLProductGetResult"
    put:
      summary: Update an MSL product
      operationId: updateMSLProduct
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MSLProductUpdateBody"
      responses:
        "200":
          description: MSL product updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MSLProductUpdateResult"
    delete:
      summary: Remove an MSL product
      operationId: removeMSLProduct
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: MSL product removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MSLProductRemoveResult"
  /msl:
    get:
      summary: Find MSLs
      operationId: findMSLs
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering MSLs
      responses:
        "200":
          description: A list of MSLs
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MSLFindResult"
    post:
      summary: Create an MSL
      operationId: createMSL
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MSLCreateBody"
      responses:
        "201":
          description: MSL created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MSLCreateResult"
  /msl/{id}:
    get:
      summary: Get an MSL by ID
      operationId: getMSL
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: MSL details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MSLGetResult"
    put:
      summary: Update an MSL
      operationId: updateMSL
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MSLUpdateBody"
      responses:
        "200":
          description: MSL updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MSLUpdateResult"
    delete:
      summary: Remove an MSL
      operationId: removeMSL
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: MSL removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MSLRemoveResult"
  /ocr-invoice-job-group:
    get:
      tags:
        - OCR Invoice Job Group
      summary: Get all OCR invoice job groups
      description: >-
        Retrieve a list of all OCR invoice job groups with optional filtering
        and pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of OCR invoice job groups retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/OcrInvoiceJobGroup"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - OCR Invoice Job Group
      summary: Create a new OCR invoice job group
      description: Create a new OCR invoice job group with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OcrInvoiceJobGroupInput"
      responses:
        "201":
          description: OCR invoice job group created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/OcrInvoiceJobGroup"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /ocr-invoice-job-group/{id}:
    get:
      tags:
        - OCR Invoice Job Group
      summary: Get OCR invoice job group by ID
      description: Retrieve a specific OCR invoice job group by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: OCR invoice job group ID
          schema:
            type: string
      responses:
        "200":
          description: OCR invoice job group retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/OcrInvoiceJobGroup"
        "401":
          description: Unauthorized
        "404":
          description: OCR invoice job group not found
        "500":
          description: Internal server error
    put:
      tags:
        - OCR Invoice Job Group
      summary: Update OCR invoice job group
      description: Update an existing OCR invoice job group with new data
      parameters:
        - name: id
          in: path
          required: true
          description: OCR invoice job group ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OcrInvoiceJobGroupInput"
      responses:
        "200":
          description: OCR invoice job group updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/OcrInvoiceJobGroup"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: OCR invoice job group not found
        "500":
          description: Internal server error
    delete:
      tags:
        - OCR Invoice Job Group
      summary: Delete OCR invoice job group
      description: Delete an existing OCR invoice job group
      parameters:
        - name: id
          in: path
          required: true
          description: OCR invoice job group ID
          schema:
            type: string
      responses:
        "200":
          description: OCR invoice job group deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: OCR invoice job group deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: OCR invoice job group not found
        "500":
          description: Internal server error
  /ocr-invoice-job-group/{id}/jobs:
    get:
      tags:
        - OCR Invoice Job Group
      summary: Get jobs in a group
      description: Retrieve all OCR jobs belonging to a specific group
      parameters:
        - name: id
          in: path
          required: true
          description: OCR invoice job group ID
          schema:
            type: string
      responses:
        "200":
          description: OCR jobs in group retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        jobId:
                          type: string
                        status:
                          type: string
                        documentName:
                          type: string
        "401":
          description: Unauthorized
        "404":
          description: OCR invoice job group not found
        "500":
          description: Internal server error
  /ocr-invoice-job-page:
    get:
      tags:
        - OCR Invoice Job Page
      summary: Get all OCR invoice job pages
      description: >-
        Retrieve a list of all OCR invoice job pages with optional filtering and
        pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of OCR invoice job pages retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/OcrInvoiceJobPage"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - OCR Invoice Job Page
      summary: Create a new OCR invoice job page
      description: Create a new OCR invoice job page with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OcrInvoiceJobPageInput"
      responses:
        "201":
          description: OCR invoice job page created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/OcrInvoiceJobPage"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /ocr-invoice-job-page/{id}:
    get:
      tags:
        - OCR Invoice Job Page
      summary: Get OCR invoice job page by ID
      description: Retrieve a specific OCR invoice job page by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: OCR invoice job page ID
          schema:
            type: string
      responses:
        "200":
          description: OCR invoice job page retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/OcrInvoiceJobPage"
        "401":
          description: Unauthorized
        "404":
          description: OCR invoice job page not found
        "500":
          description: Internal server error
    put:
      tags:
        - OCR Invoice Job Page
      summary: Update OCR invoice job page
      description: Update an existing OCR invoice job page with new data
      parameters:
        - name: id
          in: path
          required: true
          description: OCR invoice job page ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OcrInvoiceJobPageInput"
      responses:
        "200":
          description: OCR invoice job page updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/OcrInvoiceJobPage"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: OCR invoice job page not found
        "500":
          description: Internal server error
    delete:
      tags:
        - OCR Invoice Job Page
      summary: Delete OCR invoice job page
      description: Delete an existing OCR invoice job page
      parameters:
        - name: id
          in: path
          required: true
          description: OCR invoice job page ID
          schema:
            type: string
      responses:
        "200":
          description: OCR invoice job page deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: OCR invoice job page deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: OCR invoice job page not found
        "500":
          description: Internal server error
  /ocr-invoice-job-page/{id}/process:
    post:
      tags:
        - OCR Invoice Job Page
      summary: Process OCR invoice job page
      description: Start processing a specific page of an OCR invoice job
      parameters:
        - name: id
          in: path
          required: true
          description: OCR invoice job page ID
          schema:
            type: string
      responses:
        "200":
          description: OCR invoice job page processing started
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      pageId:
                        type: string
                      status:
                        type: string
                        enum:
                          - queued
                          - processing
        "401":
          description: Unauthorized
        "404":
          description: OCR invoice job page not found
        "500":
          description: Internal server error
  /ocr-invoice-job-template:
    get:
      tags:
        - OCR Invoice Job Template
      summary: Get all OCR invoice job templates
      description: >-
        Retrieve a list of all OCR invoice job templates with optional filtering
        and pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of OCR invoice job templates retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/OcrInvoiceJobTemplate"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - OCR Invoice Job Template
      summary: Create a new OCR invoice job template
      description: Create a new OCR invoice job template with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OcrInvoiceJobTemplateInput"
      responses:
        "201":
          description: OCR invoice job template created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/OcrInvoiceJobTemplate"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /ocr-invoice-job-template/{id}:
    get:
      tags:
        - OCR Invoice Job Template
      summary: Get OCR invoice job template by ID
      description: Retrieve a specific OCR invoice job template by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: OCR invoice job template ID
          schema:
            type: string
      responses:
        "200":
          description: OCR invoice job template retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/OcrInvoiceJobTemplate"
        "401":
          description: Unauthorized
        "404":
          description: OCR invoice job template not found
        "500":
          description: Internal server error
    put:
      tags:
        - OCR Invoice Job Template
      summary: Update OCR invoice job template
      description: Update an existing OCR invoice job template with new data
      parameters:
        - name: id
          in: path
          required: true
          description: OCR invoice job template ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OcrInvoiceJobTemplateInput"
      responses:
        "200":
          description: OCR invoice job template updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/OcrInvoiceJobTemplate"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: OCR invoice job template not found
        "500":
          description: Internal server error
    delete:
      tags:
        - OCR Invoice Job Template
      summary: Delete OCR invoice job template
      description: Delete an existing OCR invoice job template
      parameters:
        - name: id
          in: path
          required: true
          description: OCR invoice job template ID
          schema:
            type: string
      responses:
        "200":
          description: OCR invoice job template deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: OCR invoice job template deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: OCR invoice job template not found
        "500":
          description: Internal server error
  /ocr-invoice-job:
    get:
      tags:
        - OCR Invoice Job
      summary: Get all OCR invoice jobs
      description: >-
        Retrieve a list of all OCR invoice jobs with optional filtering and
        pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of OCR invoice jobs retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/OcrInvoiceJob"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - OCR Invoice Job
      summary: Create a new OCR invoice job
      description: Create a new OCR invoice job with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OcrInvoiceJobInput"
      responses:
        "201":
          description: OCR invoice job created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/OcrInvoiceJob"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /ocr-invoice-job/{id}:
    get:
      tags:
        - OCR Invoice Job
      summary: Get OCR invoice job by ID
      description: Retrieve a specific OCR invoice job by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: OCR invoice job ID
          schema:
            type: string
      responses:
        "200":
          description: OCR invoice job retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/OcrInvoiceJob"
        "401":
          description: Unauthorized
        "404":
          description: OCR invoice job not found
        "500":
          description: Internal server error
    put:
      tags:
        - OCR Invoice Job
      summary: Update OCR invoice job
      description: Update an existing OCR invoice job with new data
      parameters:
        - name: id
          in: path
          required: true
          description: OCR invoice job ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/OcrInvoiceJobInput"
      responses:
        "200":
          description: OCR invoice job updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/OcrInvoiceJob"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: OCR invoice job not found
        "500":
          description: Internal server error
    delete:
      tags:
        - OCR Invoice Job
      summary: Delete OCR invoice job
      description: Delete an existing OCR invoice job
      parameters:
        - name: id
          in: path
          required: true
          description: OCR invoice job ID
          schema:
            type: string
      responses:
        "200":
          description: OCR invoice job deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: OCR invoice job deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: OCR invoice job not found
        "500":
          description: Internal server error
  /ocr-invoice-job/{id}/process:
    post:
      tags:
        - OCR Invoice Job
      summary: Process OCR invoice job
      description: Start processing an OCR invoice job
      parameters:
        - name: id
          in: path
          required: true
          description: OCR invoice job ID
          schema:
            type: string
      responses:
        "200":
          description: OCR invoice job processing started
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      jobId:
                        type: string
                      status:
                        type: string
                        enum:
                          - queued
                          - processing
        "401":
          description: Unauthorized
        "404":
          description: OCR invoice job not found
        "500":
          description: Internal server error
  /ocr-invoice-job/{id}/results:
    get:
      tags:
        - OCR Invoice Job
      summary: Get OCR results
      description: Retrieve the OCR processing results for a job
      parameters:
        - name: id
          in: path
          required: true
          description: OCR invoice job ID
          schema:
            type: string
      responses:
        "200":
          description: OCR results retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/OcrResults"
        "401":
          description: Unauthorized
        "404":
          description: OCR invoice job not found
        "500":
          description: Internal server error
  /patch-action:
    get:
      tags:
        - Patch Action
      summary: Get all patch action records
      description: >-
        Retrieve a list of all patch action records with optional filtering and
        pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of patch action records retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/PatchAction"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - Patch Action
      summary: Create a new patch action
      description: Create a new patch action with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PatchActionInput"
      responses:
        "201":
          description: Patch action created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/PatchAction"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /patch-action/{id}:
    get:
      tags:
        - Patch Action
      summary: Get patch action by ID
      description: Retrieve a specific patch action by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Patch action ID
          schema:
            type: string
      responses:
        "200":
          description: Patch action retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/PatchAction"
        "401":
          description: Unauthorized
        "404":
          description: Patch action not found
        "500":
          description: Internal server error
    put:
      tags:
        - Patch Action
      summary: Update patch action
      description: Update an existing patch action with new data
      parameters:
        - name: id
          in: path
          required: true
          description: Patch action ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PatchActionInput"
      responses:
        "200":
          description: Patch action updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/PatchAction"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: Patch action not found
        "500":
          description: Internal server error
    delete:
      tags:
        - Patch Action
      summary: Delete patch action
      description: Delete an existing patch action
      parameters:
        - name: id
          in: path
          required: true
          description: Patch action ID
          schema:
            type: string
      responses:
        "200":
          description: Patch action deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Patch action deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: Patch action not found
        "500":
          description: Internal server error
  /patch-action/execute/{id}:
    post:
      tags:
        - Patch Action
      summary: Execute patch action
      description: Execute a specific patch action by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Patch action ID
          schema:
            type: string
      responses:
        "200":
          description: Patch action executed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      executionId:
                        type: string
                        description: Execution ID for tracking
                      status:
                        type: string
                        enum:
                          - queued
                          - running
                          - completed
                          - failed
        "401":
          description: Unauthorized
        "404":
          description: Patch action not found
        "500":
          description: Internal server error
  /paymentterms:
    get:
      summary: Find payment terms
      operationId: findPaymentTerms
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering payment terms
      responses:
        "200":
          description: A list of payment terms
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaymentTermFindResult"
    post:
      summary: Create a payment term
      operationId: createPaymentTerm
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PaymentTermCreateBody"
      responses:
        "201":
          description: Payment term created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaymentTermCreateResult"
  /paymentterms/{id}:
    get:
      summary: Get a payment term by ID
      operationId: getPaymentTerm
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Payment term details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaymentTermGetResult"
    put:
      summary: Update a payment term
      operationId: updatePaymentTerm
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PaymentTermUpdateBody"
      responses:
        "200":
          description: Payment term updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaymentTermUpdateResult"
    delete:
      summary: Remove a payment term
      operationId: removePaymentTerm
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Payment term removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaymentTermRemoveResult"
  /payments:
    get:
      summary: Find payments
      operationId: findPayments
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering payments
      responses:
        "200":
          description: A list of payments
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaymentFindResult"
    post:
      summary: Create a payment
      operationId: createPayment
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PaymentCreateBody"
      responses:
        "201":
          description: Payment created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaymentCreateResult"
  /payments/{id}:
    get:
      summary: Get a payment by ID
      operationId: getPayment
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Payment details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaymentGetResult"
    put:
      summary: Update a payment
      operationId: updatePayment
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PaymentUpdateBody"
      responses:
        "200":
          description: Payment updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaymentUpdateResult"
  /pricelistitem:
    get:
      summary: Find price list items
      operationId: findPriceListItems
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              product_id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              variant_id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              pricelist_id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              disabled:
                type: boolean
              from_updatedAt:
                type: number
              populatedKeys:
                type: array
                items:
                  type: string
                  enum:
                    - product
                    - variant
                    - pricelist
          description: Query parameters for filtering price list items
      responses:
        "200":
          description: A list of price list items
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PriceListItemFindResult"
    post:
      summary: Create a price list item
      operationId: createPriceListItem
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PriceListItemCreateBody"
      responses:
        "201":
          description: Price list item created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PriceListItemCreateResult"
  /pricelistitem/{id}:
    get:
      summary: Get a price list item by ID
      operationId: getPriceListItem
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Price list item details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PriceListItemGetResult"
    put:
      summary: Update a price list item
      operationId: updatePriceListItem
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PriceListItemUpdateBody"
      responses:
        "200":
          description: Price list item updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PriceListItemUpdateResult"
    delete:
      summary: Remove a price list item
      operationId: removePriceListItem
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Price list item removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PriceListItemRemoveResult"
  /pricelist:
    get:
      summary: Find price lists
      operationId: findPriceLists
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              createdby._id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              disabled:
                type: boolean
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering price lists
      responses:
        "200":
          description: A list of price lists
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PriceListFindResult"
    post:
      summary: Create a price list
      operationId: createPriceList
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PriceListCreateBody"
      responses:
        "201":
          description: Price list created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PriceListCreateResult"
  /pricelist/{id}:
    get:
      summary: Get a price list by ID
      operationId: getPriceList
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Price list details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PriceListGetResult"
    put:
      summary: Update a price list
      operationId: updatePriceList
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PriceListUpdateBody"
      responses:
        "200":
          description: Price list updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PriceListUpdateResult"
    delete:
      summary: Remove a price list
      operationId: removePriceList
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Price list removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PriceListRemoveResult"
  /product-group:
    get:
      summary: Find product groups
      operationId: findProductGroups
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              local_name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              disabled:
                type: boolean
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
              createdAt:
                type: number
              updatedAt:
                type: number
          description: Query parameters for filtering product groups
      responses:
        "200":
          description: A list of product groups
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProductGroupFindResult"
    post:
      summary: Create a product group
      operationId: createProductGroup
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProductGroupCreateBody"
      responses:
        "201":
          description: Product group created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProductGroupCreateResult"
  /product-group/{id}:
    get:
      summary: Get a product group by ID
      operationId: getProductGroup
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Product group details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProductGroupGetResult"
    put:
      summary: Update a product group
      operationId: updateProductGroup
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProductGroupUpdateBody"
      responses:
        "200":
          description: Product group updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProductGroupUpdateResult"
    delete:
      summary: Remove a product group
      operationId: removeProductGroup
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Product group removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProductGroupRemoveResult"
  /product-modifiers-group:
    get:
      tags:
        - Product Modifiers Group
      summary: Get all product modifier groups
      description: >-
        Retrieve a list of all product modifier groups with optional filtering
        and pagination
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          description: Sort field
          required: false
          schema:
            type: string
        - name: company_namespace
          in: query
          description: Company namespace for filtering
          required: false
          schema:
            type: array
            items:
              type: string
        - name: disabled
          in: query
          description: Filter by disabled status
          required: false
          schema:
            type: boolean
        - name: _id
          in: query
          description: Filter by ID
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ProductModifiersGroup"
                  paging:
                    $ref: "#/components/schemas/PagingInfo"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
    post:
      tags:
        - Product Modifiers Group
      summary: Create a new product modifier group
      description: Create a new product modifier group entry
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateProductModifiersGroupRequest"
      responses:
        "201":
          description: Product modifier group created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ProductModifiersGroup"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /product-modifiers-group/{id}:
    get:
      tags:
        - Product Modifiers Group
      summary: Get product modifier group by ID
      description: Retrieve a specific product modifier group by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Product modifier group ID
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ProductModifiersGroup"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    patch:
      tags:
        - Product Modifiers Group
      summary: Update product modifier group
      description: Update an existing product modifier group
      parameters:
        - name: id
          in: path
          required: true
          description: Product modifier group ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateProductModifiersGroupRequest"
      responses:
        "200":
          description: Product modifier group updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ProductModifiersGroup"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
    delete:
      tags:
        - Product Modifiers Group
      summary: Delete product modifier group
      description: Delete a product modifier group by ID
      parameters:
        - name: id
          in: path
          required: true
          description: Product modifier group ID
          schema:
            type: string
      responses:
        "200":
          description: Product modifier group deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /product-modifiers-group/remove:
    post:
      tags:
        - Product Modifiers Group
      summary: Bulk delete product modifier groups
      description: Delete multiple product modifier groups by their IDs
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                ids:
                  type: array
                  items:
                    type: string
                  description: Array of product modifier group IDs to delete
              required:
                - ids
      responses:
        "200":
          description: Product modifier groups deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /product:
    get:
      summary: Find products
      operationId: findProducts
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering products
      responses:
        "200":
          description: A list of products
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProductFindResult"
    post:
      summary: Create a product
      operationId: createProduct
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProductCreateBody"
      responses:
        "201":
          description: Product created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProductCreateResult"
  /product/{id}:
    get:
      summary: Get a product by ID
      operationId: getProduct
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Product details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProductGetResult"
    put:
      summary: Update a product
      operationId: updateProduct
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProductUpdateBody"
      responses:
        "200":
          description: Product updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProductUpdateResult"
    delete:
      summary: Remove a product
      operationId: removeProduct
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Product removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProductRemoveResult"
  /proforma:
    get:
      summary: Find proformas
      operationId: findProformas
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering proformas
      responses:
        "200":
          description: A list of proformas
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProformaFindResult"
    post:
      summary: Create a proforma
      operationId: createProforma
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProformaCreateBody"
      responses:
        "201":
          description: Proforma created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProformaCreateResult"
  /proforma/{id}:
    get:
      summary: Get a proforma by ID
      operationId: getProforma
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Proforma details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProformaGetResult"
    put:
      summary: Update a proforma
      operationId: updateProforma
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProformaUpdateBody"
      responses:
        "200":
          description: Proforma updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProformaUpdateResult"
  /quick-convert-to-pdf:
    post:
      summary: Convert document to PDF
      operationId: quickConvertToPdf
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/QuickConvertToPdfBody"
      responses:
        "200":
          description: PDF conversion successful
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/QuickConvertToPdfResult"
  /receiving-material:
    get:
      summary: Find receiving materials
      operationId: findReceivingMaterials
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              warehouse:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              supplier:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              rep:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              status:
                type: string
                enum:
                  - pending
                  - received
                  - cancelled
              from_date:
                type: string
                format: date-time
              to_date:
                type: string
                format: date-time
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                        - createdAt
                        - updatedAt
                        - receiptDate
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering receiving materials
      responses:
        "200":
          description: A list of receiving materials
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReceivingMaterialFindResult"
    post:
      summary: Create a receiving material
      operationId: createReceivingMaterial
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ReceivingMaterialCreateBody"
      responses:
        "201":
          description: Receiving material created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReceivingMaterialCreateResult"
  /receiving-material/{id}:
    get:
      summary: Get a receiving material by ID
      operationId: getReceivingMaterial
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Receiving material details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReceivingMaterialGetResult"
    put:
      summary: Update a receiving material
      operationId: updateReceivingMaterial
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ReceivingMaterialUpdateBody"
      responses:
        "200":
          description: Receiving material updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReceivingMaterialUpdateResult"
  /refund:
    get:
      summary: Find refunds
      operationId: findRefunds
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              client:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              rep:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              status:
                type: string
                enum:
                  - pending
                  - approved
                  - rejected
                  - processed
              from_date:
                type: string
                format: date-time
              to_date:
                type: string
                format: date-time
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                        - createdAt
                        - updatedAt
                        - amount
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering refunds
      responses:
        "200":
          description: A list of refunds
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RefundFindResult"
    post:
      summary: Create a refund
      operationId: createRefund
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RefundCreateBody"
      responses:
        "201":
          description: Refund created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RefundCreateResult"
  /refund/{id}:
    get:
      summary: Get a refund by ID
      operationId: getRefund
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Refund details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RefundGetResult"
    put:
      summary: Update a refund
      operationId: updateRefund
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RefundUpdateBody"
      responses:
        "200":
          description: Refund updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RefundUpdateResult"
  /rep-balance-summary:
    get:
      summary: Find rep balance summaries
      operationId: findRepBalanceSummaries
      parameters:
        - in: query
          name: rep
          required: true
          schema:
            type: string
          description: The rep ID to get balance summary for
        - in: query
          name: page
          schema:
            type: integer
            minimum: 1
            default: 1
          description: Page number for pagination
        - in: query
          name: per_page
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
          description: Number of items per page
        - in: query
          name: disabled
          schema:
            type: boolean
            default: false
          description: Whether to include disabled records
        - in: query
          name: populatedKeys
          schema:
            type: array
            items:
              type: string
          description: Keys to populate in the response
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  total_result:
                    type: integer
                    description: Total number of results
                  current_count:
                    type: integer
                    description: Number of results in current page
                  total_pages:
                    type: integer
                    description: Total number of pages
                  current_page:
                    type: integer
                    description: Current page number
                  per_page:
                    type: integer
                    description: Number of items per page
                  first_page_url:
                    type: string
                    description: URL for first page
                  last_page_url:
                    type: string
                    description: URL for last page
                  next_page_url:
                    type: string
                    nullable: true
                    description: URL for next page
                  prev_page_url:
                    type: string
                    nullable: true
                    description: URL for previous page
                  path:
                    type: string
                    description: Base path for the endpoint
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/RepBalanceSummary"
                  totals:
                    type: object
                    properties:
                      total_balances:
                        type: number
                        description: Sum of all balance summaries
                  options:
                    type: object
                    properties:
                      has_more:
                        type: boolean
                        description: Whether there are more results
                      include_documents_count:
                        type: boolean
                        description: Whether document count is included
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /rep:
    get:
      summary: Find reps
      operationId: findReps
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              team_id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              password:
                type: string
              email:
                type: string
              phone:
                type: string
              username:
                type: string
              disabled:
                type: boolean
              role:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
              permissions.rep_can_add_client:
                type: boolean
              permissions.rep_can_edit_client:
                type: boolean
          description: Query parameters for filtering reps
      responses:
        "200":
          description: A list of reps
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RepFindResult"
    post:
      summary: Create a rep
      operationId: createRep
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RepCreateBody"
      responses:
        "201":
          description: Rep created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RepCreateResult"
  /rep/{id}:
    get:
      summary: Get a rep by ID
      operationId: getRep
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Rep details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RepGetResult"
    put:
      summary: Update a rep
      operationId: updateRep
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RepUpdateBody"
      responses:
        "200":
          description: Rep updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RepUpdateResult"
    delete:
      summary: Remove a rep
      operationId: removeRep
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Rep removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RepRemoveResult"
  /return-asset-part-unit:
    get:
      tags:
        - Return Asset Part Unit
      summary: Get all asset part unit returns
      description: >-
        Retrieve a list of all asset part unit returns with optional filtering
        and pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of asset part unit returns retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/ReturnAssetPartUnit"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - Return Asset Part Unit
      summary: Create a new asset part unit return
      description: Create a new asset part unit return with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ReturnAssetPartUnitInput"
      responses:
        "201":
          description: Asset part unit return created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ReturnAssetPartUnit"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /return-asset-part-unit/{id}:
    get:
      tags:
        - Return Asset Part Unit
      summary: Get asset part unit return by ID
      description: Retrieve a specific asset part unit return by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part unit return ID
          schema:
            type: string
      responses:
        "200":
          description: Asset part unit return retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ReturnAssetPartUnit"
        "401":
          description: Unauthorized
        "404":
          description: Asset part unit return not found
        "500":
          description: Internal server error
    put:
      tags:
        - Return Asset Part Unit
      summary: Update asset part unit return
      description: Update an existing asset part unit return with new data
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part unit return ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ReturnAssetPartUnitInput"
      responses:
        "200":
          description: Asset part unit return updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/ReturnAssetPartUnit"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: Asset part unit return not found
        "500":
          description: Internal server error
    delete:
      tags:
        - Return Asset Part Unit
      summary: Delete asset part unit return
      description: Delete an existing asset part unit return
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part unit return ID
          schema:
            type: string
      responses:
        "200":
          description: Asset part unit return deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Asset part unit return deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: Asset part unit return not found
        "500":
          description: Internal server error
  /return-reason:
    get:
      summary: Find return reasons
      operationId: findReturnReasons
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              local_name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              disabled:
                type: boolean
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering return reasons
      responses:
        "200":
          description: A list of return reasons
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReturnReasonFindResult"
    post:
      summary: Create a return reason
      operationId: createReturnReason
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ReturnReasonCreateBody"
      responses:
        "201":
          description: Return reason created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReturnReasonCreateResult"
  /return-reason/{id}:
    get:
      summary: Get a return reason by ID
      operationId: getReturnReason
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Return reason details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReturnReasonGetResult"
    put:
      summary: Update a return reason
      operationId: updateReturnReason
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ReturnReasonUpdateBody"
      responses:
        "200":
          description: Return reason updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReturnReasonUpdateResult"
    delete:
      summary: Remove a return reason
      operationId: removeReturnReason
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Return reason removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReturnReasonRemoveResult"
  /route:
    get:
      summary: Find routes
      operationId: findRoutes
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              disabled:
                type: boolean
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              rep_id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                        - name
                        - day
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering routes
      responses:
        "200":
          description: A list of routes
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RouteFindResult"
    post:
      summary: Create a route
      operationId: createRoute
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RouteCreateBody"
      responses:
        "201":
          description: Route created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RouteCreateResult"
  /route/{id}:
    get:
      summary: Get a route by ID
      operationId: getRoute
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Route details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RouteGetResult"
    put:
      summary: Update a route
      operationId: updateRoute
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RouteUpdateBody"
      responses:
        "200":
          description: Route updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RouteUpdateResult"
    delete:
      summary: Remove a route
      operationId: removeRoute
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Route removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RouteRemoveResult"
  /safe-invoice-serial-counter:
    get:
      tags:
        - Safe Invoice Serial Counter
      summary: Get all safe invoice serial counters
      description: >-
        Retrieve a list of all safe invoice serial counters with optional
        filtering and pagination
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          description: Sort field
          required: false
          schema:
            type: string
        - name: company_namespace
          in: query
          description: Company namespace for filtering
          required: false
          schema:
            type: array
            items:
              type: string
        - name: rep
          in: query
          description: Filter by representative ID
          required: false
          schema:
            type: string
        - name: warehouse
          in: query
          description: Filter by warehouse ID
          required: false
          schema:
            type: string
        - name: _id
          in: query
          description: Filter by ID
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/SafeInvoiceSerialCounter"
                  paging:
                    $ref: "#/components/schemas/PagingInfo"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
    post:
      tags:
        - Safe Invoice Serial Counter
      summary: Create a new safe invoice serial counter
      description: Create a new safe invoice serial counter entry
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateSafeInvoiceSerialCounterRequest"
      responses:
        "201":
          description: Safe invoice serial counter created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/SafeInvoiceSerialCounter"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /safe-invoice-serial-counter/{id}:
    get:
      tags:
        - Safe Invoice Serial Counter
      summary: Get safe invoice serial counter by ID
      description: Retrieve a specific safe invoice serial counter by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Safe invoice serial counter ID
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/SafeInvoiceSerialCounter"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    patch:
      tags:
        - Safe Invoice Serial Counter
      summary: Update safe invoice serial counter
      description: Update an existing safe invoice serial counter
      parameters:
        - name: id
          in: path
          required: true
          description: Safe invoice serial counter ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateSafeInvoiceSerialCounterRequest"
      responses:
        "200":
          description: Safe invoice serial counter updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/SafeInvoiceSerialCounter"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
    delete:
      tags:
        - Safe Invoice Serial Counter
      summary: Delete safe invoice serial counter
      description: Delete a safe invoice serial counter by ID
      parameters:
        - name: id
          in: path
          required: true
          description: Safe invoice serial counter ID
          schema:
            type: string
      responses:
        "200":
          description: Safe invoice serial counter deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /safe-invoice-serial-counter/next:
    post:
      tags:
        - Safe Invoice Serial Counter
      summary: Get next serial number
      description: Get the next available serial number for invoice generation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                rep:
                  type: string
                  description: Representative ID
                warehouse:
                  type: string
                  description: Warehouse ID
                invoice_type:
                  type: string
                  description: Type of invoice
                  enum:
                    - sales
                    - return
                    - proforma
              required:
                - rep
                - warehouse
                - invoice_type
      responses:
        "200":
          description: Next serial number retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      next_serial:
                        type: integer
                        description: Next available serial number
                        example: 1001
                      formatted_serial:
                        type: string
                        description: Formatted serial number
                        example: INV-2024-001001
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /settings:
    get:
      summary: Find settings
      operationId: findSettings
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering settings
      responses:
        "200":
          description: A list of settings
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SettingsFindResult"
  /settings/{id}:
    get:
      summary: Get settings by ID
      operationId: getSettings
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Settings details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SettingsGetResult"
    put:
      summary: Update settings
      operationId: updateSettings
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SettingsUpdateBody"
      responses:
        "200":
          description: Settings updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SettingsUpdateResult"
  /settlement:
    get:
      summary: Find settlements
      operationId: findSettlements
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              client:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              rep:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              status:
                type: string
                enum:
                  - pending
                  - completed
                  - cancelled
              from_date:
                type: string
                format: date-time
              to_date:
                type: string
                format: date-time
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                        - createdAt
                        - updatedAt
                        - totalAmount
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering settlements
      responses:
        "200":
          description: A list of settlements
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SettlementFindResult"
    post:
      summary: Create a settlement
      operationId: createSettlement
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SettlementCreateBody"
      responses:
        "201":
          description: Settlement created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SettlementCreateResult"
  /settlement/{id}:
    get:
      summary: Get a settlement by ID
      operationId: getSettlement
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Settlement details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SettlementGetResult"
  /speciality:
    get:
      tags:
        - Speciality
      summary: Get all specialities
      description: >-
        Retrieve a list of all specialities with optional filtering and
        pagination
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          description: Sort field
          required: false
          schema:
            type: string
        - name: company_namespace
          in: query
          description: Company namespace for filtering
          required: false
          schema:
            type: array
            items:
              type: string
        - name: disabled
          in: query
          description: Filter by disabled status
          required: false
          schema:
            type: boolean
        - name: _id
          in: query
          description: Filter by ID
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/Speciality"
                  paging:
                    $ref: "#/components/schemas/PagingInfo"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
    post:
      tags:
        - Speciality
      summary: Create a new speciality
      description: Create a new speciality entry
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateSpecialityRequest"
      responses:
        "201":
          description: Speciality created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/Speciality"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /speciality/{id}:
    get:
      tags:
        - Speciality
      summary: Get speciality by ID
      description: Retrieve a specific speciality by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Speciality ID
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/Speciality"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    patch:
      tags:
        - Speciality
      summary: Update speciality
      description: Update an existing speciality
      parameters:
        - name: id
          in: path
          required: true
          description: Speciality ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateSpecialityRequest"
      responses:
        "200":
          description: Speciality updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/Speciality"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
    delete:
      tags:
        - Speciality
      summary: Delete speciality
      description: Delete a speciality by ID
      parameters:
        - name: id
          in: path
          required: true
          description: Speciality ID
          schema:
            type: string
      responses:
        "200":
          description: Speciality deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /speciality/remove:
    post:
      tags:
        - Speciality
      summary: Bulk delete specialities
      description: Delete multiple specialities by their IDs
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                ids:
                  type: array
                  items:
                    type: string
                  description: Array of speciality IDs to delete
              required:
                - ids
      responses:
        "200":
          description: Specialities deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /store-asset-part-unit:
    get:
      tags:
        - Store Asset Part Unit
      summary: Get all asset part unit storage records
      description: >-
        Retrieve a list of all asset part unit storage records with optional
        filtering and pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of asset part unit storage records retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/StoreAssetPartUnit"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - Store Asset Part Unit
      summary: Create a new asset part unit storage record
      description: Create a new asset part unit storage record with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StoreAssetPartUnitInput"
      responses:
        "201":
          description: Asset part unit storage record created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/StoreAssetPartUnit"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /store-asset-part-unit/{id}:
    get:
      tags:
        - Store Asset Part Unit
      summary: Get asset part unit storage record by ID
      description: Retrieve a specific asset part unit storage record by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part unit storage record ID
          schema:
            type: string
      responses:
        "200":
          description: Asset part unit storage record retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/StoreAssetPartUnit"
        "401":
          description: Unauthorized
        "404":
          description: Asset part unit storage record not found
        "500":
          description: Internal server error
    put:
      tags:
        - Store Asset Part Unit
      summary: Update asset part unit storage record
      description: Update an existing asset part unit storage record with new data
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part unit storage record ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StoreAssetPartUnitInput"
      responses:
        "200":
          description: Asset part unit storage record updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/StoreAssetPartUnit"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: Asset part unit storage record not found
        "500":
          description: Internal server error
    delete:
      tags:
        - Store Asset Part Unit
      summary: Delete asset part unit storage record
      description: Delete an existing asset part unit storage record
      parameters:
        - name: id
          in: path
          required: true
          description: Asset part unit storage record ID
          schema:
            type: string
      responses:
        "200":
          description: Asset part unit storage record deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Asset part unit storage record deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: Asset part unit storage record not found
        "500":
          description: Internal server error
  /storecheck-template:
    get:
      summary: Find storecheck templates
      operationId: findStorecheckTemplates
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              name:
                type: string
              category:
                type: string
              disabled:
                type: boolean
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                        - createdAt
                        - updatedAt
                        - name
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering storecheck templates
      responses:
        "200":
          description: A list of storecheck templates
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StorecheckTemplateFindResult"
    post:
      summary: Create a storecheck template
      operationId: createStorecheckTemplate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StorecheckTemplateCreateBody"
      responses:
        "201":
          description: Storecheck template created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StorecheckTemplateCreateResult"
  /storecheck-template/{id}:
    get:
      summary: Get a storecheck template by ID
      operationId: getStorecheckTemplate
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Storecheck template details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StorecheckTemplateGetResult"
    put:
      summary: Update a storecheck template
      operationId: updateStorecheckTemplate
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StorecheckTemplateUpdateBody"
      responses:
        "200":
          description: Storecheck template updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StorecheckTemplateUpdateResult"
    delete:
      summary: Remove a storecheck template
      operationId: removeStorecheckTemplate
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Storecheck template removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StorecheckTemplateRemoveResult"
  /product/sub-categories:
    get:
      summary: Find subcategories
      operationId: findSubCategories
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              populatedKeys:
                type: array
                items:
                  type: string
                  enum:
                    - parent_id
              _id:
                type: array
                items:
                  type: string
              search:
                type: string
              name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              local_name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              parent_id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              disabled:
                type: boolean
              position:
                oneOf:
                  - type: array
                    items:
                      type: number
                  - type: number
              from_updatedAt:
                type: number
              createdAt:
                type: number
              updatedAt:
                type: number
              withProduct:
                type: boolean
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering subcategories
      responses:
        "200":
          description: A list of subcategories
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SubCategoryFindResult"
    post:
      summary: Create a subcategory
      operationId: createSubCategory
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SubCategoryCreateBody"
      responses:
        "201":
          description: SubCategory created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SubCategoryCreateResult"
  /product/sub-categories/{id}:
    get:
      summary: Get a subcategory by ID
      operationId: getSubCategory
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
        - in: query
          name: params
          schema:
            type: object
            properties:
              populatedKeys:
                type: array
                items:
                  type: string
                  enum:
                    - parent_id
      responses:
        "200":
          description: SubCategory details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SubCategoryGetResult"
    put:
      summary: Update a subcategory
      operationId: updateSubCategory
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SubCategoryUpdateBody"
      responses:
        "200":
          description: SubCategory updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SubCategoryUpdateResult"
    delete:
      summary: Remove a subcategory
      operationId: removeSubCategory
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: SubCategory removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SubCategoryRemoveResult"
  /supplier:
    get:
      summary: Find suppliers
      operationId: findSuppliers
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering suppliers
      responses:
        "200":
          description: A list of suppliers
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SupplierFindResult"
    post:
      summary: Create a supplier
      operationId: createSupplier
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SupplierCreateBody"
      responses:
        "201":
          description: Supplier created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SupplierCreateResult"
  /supplier/{id}:
    get:
      summary: Get a supplier by ID
      operationId: getSupplier
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Supplier details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SupplierGetResult"
    put:
      summary: Update a supplier
      operationId: updateSupplier
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SupplierUpdateBody"
      responses:
        "200":
          description: Supplier updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SupplierUpdateResult"
    delete:
      summary: Remove a supplier
      operationId: removeSupplier
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Supplier removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SupplierRemoveResult"
  /svix-integration:
    get:
      tags:
        - Svix Integration
      summary: Get all Svix integration records
      description: >-
        Retrieve a list of all Svix integration records with optional filtering
        and pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of Svix integration records retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/SvixIntegration"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - Svix Integration
      summary: Create a new Svix integration
      description: Create a new Svix integration with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SvixIntegrationInput"
      responses:
        "201":
          description: Svix integration created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/SvixIntegration"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /svix-integration/{id}:
    get:
      tags:
        - Svix Integration
      summary: Get Svix integration by ID
      description: Retrieve a specific Svix integration by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Svix integration ID
          schema:
            type: string
      responses:
        "200":
          description: Svix integration retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/SvixIntegration"
        "401":
          description: Unauthorized
        "404":
          description: Svix integration not found
        "500":
          description: Internal server error
    put:
      tags:
        - Svix Integration
      summary: Update Svix integration
      description: Update an existing Svix integration with new data
      parameters:
        - name: id
          in: path
          required: true
          description: Svix integration ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SvixIntegrationInput"
      responses:
        "200":
          description: Svix integration updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/SvixIntegration"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: Svix integration not found
        "500":
          description: Internal server error
    delete:
      tags:
        - Svix Integration
      summary: Delete Svix integration
      description: Delete an existing Svix integration
      parameters:
        - name: id
          in: path
          required: true
          description: Svix integration ID
          schema:
            type: string
      responses:
        "200":
          description: Svix integration deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Svix integration deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: Svix integration not found
        "500":
          description: Internal server error
  /tag:
    get:
      summary: Find tags
      operationId: findTags
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              disabled:
                type: boolean
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering tags
      responses:
        "200":
          description: A list of tags
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TagFindResult"
    post:
      summary: Create a tag
      operationId: createTag
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TagCreateBody"
      responses:
        "201":
          description: Tag created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TagCreateResult"
  /tag/{id}:
    get:
      summary: Get a tag by ID
      operationId: getTag
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Tag details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TagGetResult"
    put:
      summary: Update a tag
      operationId: updateTag
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TagUpdateBody"
      responses:
        "200":
          description: Tag updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TagUpdateResult"
    delete:
      summary: Remove a tag
      operationId: removeTag
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Tag removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TagRemoveResult"
  /tax:
    get:
      summary: Find taxes
      operationId: findTaxes
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              rate:
                oneOf:
                  - type: array
                    items:
                      type: number
                  - type: number
              type:
                type: string
                enum:
                  - inclusive
                  - additive
                  - N/A
              disabled:
                type: boolean
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering taxes
      responses:
        "200":
          description: A list of taxes
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TaxFindResult"
    post:
      summary: Create a tax
      operationId: createTax
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TaxCreateBody"
      responses:
        "201":
          description: Tax created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TaxCreateResult"
  /tax/{id}:
    get:
      summary: Get a tax by ID
      operationId: getTax
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Tax details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TaxGetResult"
    put:
      summary: Update a tax
      operationId: updateTax
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TaxUpdateBody"
      responses:
        "200":
          description: Tax updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TaxUpdateResult"
    delete:
      summary: Remove a tax
      operationId: removeTax
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Tax removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TaxRemoveResult"
  /team:
    get:
      summary: Find teams
      operationId: findTeams
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              disabled:
                type: boolean
              from_updatedAt:
                type: number
              to_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering teams
      responses:
        "200":
          description: A list of teams
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TeamFindResult"
    post:
      summary: Create a team
      operationId: createTeam
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TeamCreateBody"
      responses:
        "201":
          description: Team created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TeamCreateResult"
  /team/{id}:
    get:
      summary: Get a team by ID
      operationId: getTeam
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Team details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TeamGetResult"
    put:
      summary: Update a team
      operationId: updateTeam
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TeamUpdateBody"
      responses:
        "200":
          description: Team updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TeamUpdateResult"
    delete:
      summary: Remove a team
      operationId: removeTeam
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Team removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TeamRemoveResult"
  /transfer:
    get:
      summary: Find transfers
      operationId: findTransfers
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              fromWarehouse:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              toWarehouse:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              rep:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              status:
                type: string
                enum:
                  - pending
                  - in_transit
                  - completed
                  - cancelled
              from_date:
                type: string
                format: date-time
              to_date:
                type: string
                format: date-time
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                        - createdAt
                        - updatedAt
                        - transferDate
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering transfers
      responses:
        "200":
          description: A list of transfers
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransferFindResult"
    post:
      summary: Create a transfer
      operationId: createTransfer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TransferCreateBody"
      responses:
        "201":
          description: Transfer created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransferCreateResult"
  /transfer/{id}:
    get:
      summary: Get a transfer by ID
      operationId: getTransfer
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Transfer details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransferGetResult"
    put:
      summary: Update a transfer
      operationId: updateTransfer
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TransferUpdateBody"
      responses:
        "200":
          description: Transfer updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransferUpdateResult"
  /update-integration-meta:
    get:
      tags:
        - Update Integration Meta
      summary: Get all integration meta update records
      description: >-
        Retrieve a list of all integration metadata update records with optional
        filtering and pagination
      parameters:
        - name: limit
          in: query
          description: Maximum number of records to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: offset
          in: query
          description: Number of records to skip for pagination
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: sort
          in: query
          description: Field to sort by
          required: false
          schema:
            type: string
        - name: order
          in: query
          description: Sort order (asc or desc)
          required: false
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
        - name: filter
          in: query
          description: Filter conditions in JSON format
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search term for text fields
          required: false
          schema:
            type: string
      responses:
        "200":
          description: List of integration meta update records retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/UpdateIntegrationMeta"
                  total:
                    type: integer
                    description: Total number of records
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
    post:
      tags:
        - Update Integration Meta
      summary: Create a new integration meta update
      description: Create a new integration metadata update with the provided data
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateIntegrationMetaInput"
      responses:
        "201":
          description: Integration meta update created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/UpdateIntegrationMeta"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "500":
          description: Internal server error
  /update-integration-meta/{id}:
    get:
      tags:
        - Update Integration Meta
      summary: Get integration meta update by ID
      description: Retrieve a specific integration metadata update by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Integration meta update ID
          schema:
            type: string
      responses:
        "200":
          description: Integration meta update retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/UpdateIntegrationMeta"
        "401":
          description: Unauthorized
        "404":
          description: Integration meta update not found
        "500":
          description: Internal server error
    put:
      tags:
        - Update Integration Meta
      summary: Update integration meta update
      description: Update an existing integration metadata update with new data
      parameters:
        - name: id
          in: path
          required: true
          description: Integration meta update ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateIntegrationMetaInput"
      responses:
        "200":
          description: Integration meta update updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/UpdateIntegrationMeta"
        "400":
          description: Bad request
        "401":
          description: Unauthorized
        "404":
          description: Integration meta update not found
        "500":
          description: Internal server error
    delete:
      tags:
        - Update Integration Meta
      summary: Delete integration meta update
      description: Delete an existing integration metadata update
      parameters:
        - name: id
          in: path
          required: true
          description: Integration meta update ID
          schema:
            type: string
      responses:
        "200":
          description: Integration meta update deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Integration meta update deleted successfully
        "401":
          description: Unauthorized
        "404":
          description: Integration meta update not found
        "500":
          description: Internal server error
  /update-integration-meta/apply/{id}:
    post:
      tags:
        - Update Integration Meta
      summary: Apply integration meta update
      description: Apply a specific integration metadata update
      parameters:
        - name: id
          in: path
          required: true
          description: Integration meta update ID
          schema:
            type: string
      responses:
        "200":
          description: Integration meta update applied successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      appliedAt:
                        type: string
                        format: date-time
                      affectedIntegrations:
                        type: integer
        "401":
          description: Unauthorized
        "404":
          description: Integration meta update not found
        "500":
          description: Internal server error
  /variant:
    get:
      summary: Find variants
      operationId: findVariants
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering variants
      responses:
        "200":
          description: A list of variants
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VariantFindResult"
    post:
      summary: Create a variant
      operationId: createVariant
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/VariantCreateBody"
      responses:
        "201":
          description: Variant created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VariantCreateResult"
  /variant/{id}:
    get:
      summary: Get a variant by ID
      operationId: getVariant
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Variant details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VariantGetResult"
    put:
      summary: Update a variant
      operationId: updateVariant
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/VariantUpdateBody"
      responses:
        "200":
          description: Variant updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VariantUpdateResult"
    delete:
      summary: Remove a variant
      operationId: removeVariant
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Variant removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VariantRemoveResult"
  /visit:
    get:
      summary: Find visits
      operationId: findVisits
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering visits
      responses:
        "200":
          description: A list of visits
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VisitFindResult"
    post:
      summary: Create a visit
      operationId: createVisit
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/VisitCreateBody"
      responses:
        "201":
          description: Visit created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VisitCreateResult"
  /visit/{id}:
    get:
      summary: Get a visit by ID
      operationId: getVisit
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Visit details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VisitGetResult"
    put:
      summary: Update a visit
      operationId: updateVisit
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/VisitUpdateBody"
      responses:
        "200":
          description: Visit updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VisitUpdateResult"
  /warehouse:
    get:
      summary: Find warehouses
      operationId: findWarehouses
      parameters:
        - in: query
          name: params
          schema:
            type: object
            properties:
              _id:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              search:
                type: string
              name:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: string
              disabled:
                type: boolean
              from_updatedAt:
                type: number
              from__id:
                type: string
              to__id:
                type: string
              sortBy:
                type: array
                items:
                  type: object
                  properties:
                    field:
                      type: string
                      enum:
                        - _id
                    type:
                      type: string
                      enum:
                        - asc
                        - desc
          description: Query parameters for filtering warehouses
      responses:
        "200":
          description: A list of warehouses
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WarehouseFindResult"
    post:
      summary: Create a warehouse
      operationId: createWarehouse
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WarehouseCreateBody"
      responses:
        "201":
          description: Warehouse created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WarehouseCreateResult"
  /warehouse/{id}:
    get:
      summary: Get a warehouse by ID
      operationId: getWarehouse
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Warehouse details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WarehouseGetResult"
    put:
      summary: Update a warehouse
      operationId: updateWarehouse
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WarehouseUpdateBody"
      responses:
        "200":
          description: Warehouse updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WarehouseUpdateResult"
    delete:
      summary: Remove a warehouse
      operationId: removeWarehouse
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Warehouse removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WarehouseRemoveResult"
  /workorder-category:
    get:
      tags:
        - Workorder Category
      summary: Get all workorder categories
      description: >-
        Retrieve a list of all workorder categories with optional filtering and
        pagination
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          description: Sort field
          required: false
          schema:
            type: string
        - name: company_namespace
          in: query
          description: Company namespace for filtering
          required: false
          schema:
            type: array
            items:
              type: string
        - name: disabled
          in: query
          description: Filter by disabled status
          required: false
          schema:
            type: boolean
        - name: parent_category
          in: query
          description: Filter by parent category ID
          required: false
          schema:
            type: string
        - name: _id
          in: query
          description: Filter by ID
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/WorkorderCategory"
                  paging:
                    $ref: "#/components/schemas/PagingInfo"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
    post:
      tags:
        - Workorder Category
      summary: Create a new workorder category
      description: Create a new workorder category
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateWorkorderCategoryRequest"
      responses:
        "201":
          description: Workorder category created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/WorkorderCategory"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /workorder-category/{id}:
    get:
      tags:
        - Workorder Category
      summary: Get workorder category by ID
      description: Retrieve a specific workorder category by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Workorder category ID
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/WorkorderCategory"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    patch:
      tags:
        - Workorder Category
      summary: Update workorder category
      description: Update an existing workorder category
      parameters:
        - name: id
          in: path
          required: true
          description: Workorder category ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateWorkorderCategoryRequest"
      responses:
        "200":
          description: Workorder category updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/WorkorderCategory"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
    delete:
      tags:
        - Workorder Category
      summary: Delete workorder category
      description: Delete a workorder category by ID
      parameters:
        - name: id
          in: path
          required: true
          description: Workorder category ID
          schema:
            type: string
      responses:
        "200":
          description: Workorder category deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /workorder-category/remove:
    post:
      tags:
        - Workorder Category
      summary: Bulk delete workorder categories
      description: Delete multiple workorder categories by their IDs
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                ids:
                  type: array
                  items:
                    type: string
                  description: Array of workorder category IDs to delete
              required:
                - ids
      responses:
        "200":
          description: Workorder categories deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /workorder-category/hierarchy:
    get:
      tags:
        - Workorder Category
      summary: Get category hierarchy
      description: Get workorder categories in hierarchical structure
      responses:
        "200":
          description: Category hierarchy retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/WorkorderCategoryHierarchy"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /workorder-portal-link:
    get:
      tags:
        - Workorder Portal Link
      summary: Get all workorder portal links
      description: >-
        Retrieve a list of all workorder portal links with optional filtering
        and pagination
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          description: Sort field
          required: false
          schema:
            type: string
        - name: company_namespace
          in: query
          description: Company namespace for filtering
          required: false
          schema:
            type: array
            items:
              type: string
        - name: workorder
          in: query
          description: Filter by workorder ID
          required: false
          schema:
            type: string
        - name: is_active
          in: query
          description: Filter by active status
          required: false
          schema:
            type: boolean
        - name: link_type
          in: query
          description: Filter by link type
          required: false
          schema:
            type: string
            enum:
              - public
              - private
              - secure
        - name: _id
          in: query
          description: Filter by ID
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/WorkorderPortalLink"
                  paging:
                    $ref: "#/components/schemas/PagingInfo"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
    post:
      tags:
        - Workorder Portal Link
      summary: Create a new workorder portal link
      description: Create a new workorder portal link
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateWorkorderPortalLinkRequest"
      responses:
        "201":
          description: Workorder portal link created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/WorkorderPortalLink"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /workorder-portal-link/{id}:
    get:
      tags:
        - Workorder Portal Link
      summary: Get workorder portal link by ID
      description: Retrieve a specific workorder portal link by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Workorder portal link ID
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/WorkorderPortalLink"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    patch:
      tags:
        - Workorder Portal Link
      summary: Update workorder portal link
      description: Update an existing workorder portal link
      parameters:
        - name: id
          in: path
          required: true
          description: Workorder portal link ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateWorkorderPortalLinkRequest"
      responses:
        "200":
          description: Workorder portal link updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/WorkorderPortalLink"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
    delete:
      tags:
        - Workorder Portal Link
      summary: Delete workorder portal link
      description: Delete a workorder portal link by ID
      parameters:
        - name: id
          in: path
          required: true
          description: Workorder portal link ID
          schema:
            type: string
      responses:
        "200":
          description: Workorder portal link deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /workorder-portal-link/{id}/regenerate:
    post:
      tags:
        - Workorder Portal Link
      summary: Regenerate portal link
      description: Regenerate the portal link URL and access token
      parameters:
        - name: id
          in: path
          required: true
          description: Workorder portal link ID
          schema:
            type: string
      responses:
        "200":
          description: Portal link regenerated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/WorkorderPortalLink"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /workorder-portal-link/{id}/activate:
    post:
      tags:
        - Workorder Portal Link
      summary: Activate portal link
      description: Activate a workorder portal link
      parameters:
        - name: id
          in: path
          required: true
          description: Workorder portal link ID
          schema:
            type: string
      responses:
        "200":
          description: Portal link activated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/WorkorderPortalLink"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /workorder-portal-link/{id}/deactivate:
    post:
      tags:
        - Workorder Portal Link
      summary: Deactivate portal link
      description: Deactivate a workorder portal link
      parameters:
        - name: id
          in: path
          required: true
          description: Workorder portal link ID
          schema:
            type: string
      responses:
        "200":
          description: Portal link deactivated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/WorkorderPortalLink"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /workorder-portal:
    get:
      tags:
        - Workorder Portal
      summary: Get workorder portal entries
      description: Retrieve workorder portal entries with optional filtering and pagination
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: per_page
          in: query
          description: Number of items per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
        - name: sort
          in: query
          description: Sort field
          required: false
          schema:
            type: string
        - name: company_namespace
          in: query
          description: Company namespace for filtering
          required: false
          schema:
            type: array
            items:
              type: string
        - name: status
          in: query
          description: Filter by status
          required: false
          schema:
            type: string
            enum:
              - pending
              - in_progress
              - completed
              - cancelled
        - name: workorder
          in: query
          description: Filter by workorder ID
          required: false
          schema:
            type: string
        - name: client
          in: query
          description: Filter by client ID
          required: false
          schema:
            type: string
        - name: _id
          in: query
          description: Filter by ID
          required: false
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/WorkorderPortal"
                  paging:
                    $ref: "#/components/schemas/PagingInfo"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalServerError"
    post:
      tags:
        - Workorder Portal
      summary: Create a new workorder portal entry
      description: Create a new workorder portal entry
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateWorkorderPortalRequest"
      responses:
        "201":
          description: Workorder portal entry created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/WorkorderPortal"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /workorder-portal/{id}:
    get:
      tags:
        - Workorder Portal
      summary: Get workorder portal entry by ID
      description: Retrieve a specific workorder portal entry by its ID
      parameters:
        - name: id
          in: path
          required: true
          description: Workorder portal entry ID
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/WorkorderPortal"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
    patch:
      tags:
        - Workorder Portal
      summary: Update workorder portal entry
      description: Update an existing workorder portal entry
      parameters:
        - name: id
          in: path
          required: true
          description: Workorder portal entry ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateWorkorderPortalRequest"
      responses:
        "200":
          description: Workorder portal entry updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/WorkorderPortal"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/ValidationError"
        "500":
          $ref: "#/components/responses/InternalServerError"
    delete:
      tags:
        - Workorder Portal
      summary: Delete workorder portal entry
      description: Delete a workorder portal entry by ID
      parameters:
        - name: id
          in: path
          required: true
          description: Workorder portal entry ID
          schema:
            type: string
      responses:
        "200":
          description: Workorder portal entry deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /workorder-portal/{id}/status:
    patch:
      tags:
        - Workorder Portal
      summary: Update workorder portal status
      description: Update the status of a workorder portal entry
      parameters:
        - name: id
          in: path
          required: true
          description: Workorder portal entry ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                  enum:
                    - pending
                    - in_progress
                    - completed
                    - cancelled
                  description: New status
                notes:
                  type: string
                  description: Status update notes
              required:
                - status
      responses:
        "200":
          description: Status updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: "#/components/schemas/WorkorderPortal"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalServerError"
  /workorder-request:
    get:
      summary: Find workorder requests
      operationId: findWorkorderRequests
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering workorder requests
      responses:
        "200":
          description: A list of workorder requests
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkorderRequestFindResult"
    post:
      summary: Create a workorder request
      operationId: createWorkorderRequest
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WorkorderRequestCreateBody"
      responses:
        "201":
          description: Workorder request created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkorderRequestCreateResult"
  /workorder-request/{id}:
    get:
      summary: Get a workorder request by ID
      operationId: getWorkorderRequest
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Workorder request details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkorderRequestGetResult"
    put:
      summary: Update a workorder request
      operationId: updateWorkorderRequest
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WorkorderRequestUpdateBody"
      responses:
        "200":
          description: Workorder request updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkorderRequestUpdateResult"
    delete:
      summary: Remove a workorder request
      operationId: removeWorkorderRequest
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Workorder request removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkorderRequestRemoveResult"
  /workorder:
    get:
      summary: Find workorders
      operationId: findWorkorders
      parameters:
        - in: query
          name: params
          schema:
            type: object
          description: Query parameters for filtering workorders
      responses:
        "200":
          description: A list of workorders
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkorderFindResult"
    post:
      summary: Create a workorder
      operationId: createWorkorder
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WorkorderCreateBody"
      responses:
        "201":
          description: Workorder created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkorderCreateResult"
  /workorder/{id}:
    get:
      summary: Get a workorder by ID
      operationId: getWorkorder
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Workorder details
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkorderGetResult"
    put:
      summary: Update a workorder
      operationId: updateWorkorder
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WorkorderUpdateBody"
      responses:
        "200":
          description: Workorder updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkorderUpdateResult"
    delete:
      summary: Remove a workorder
      operationId: removeWorkorder
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Workorder removed
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WorkorderRemoveResult"
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: "Use format: Bearer {api_key}"
  schemas:
    ActivityAiSalesOrder:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the AI sales order activity
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        client:
          type: string
          description: Client ID
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        rep:
          type: string
          description: Sales representative ID
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        activityType:
          type: string
          enum:
            - recommendation
            - order-analysis
            - demand-forecasting
            - cross-sell
            - upsell
          description: Type of AI activity
          example: recommendation
        inputData:
          type: object
          properties:
            historicalOrders:
              type: array
              items:
                type: object
                properties:
                  orderId:
                    type: string
                  date:
                    type: string
                    format: date-time
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        product:
                          type: string
                        quantity:
                          type: integer
                        price:
                          type: number
                          format: double
            clientPreferences:
              type: object
              additionalProperties: true
              description: Client preferences and behavior patterns
            marketData:
              type: object
              additionalProperties: true
              description: Market trends and seasonal data
            inventoryLevels:
              type: object
              additionalProperties: true
              description: Current inventory levels
        aiModel:
          type: object
          properties:
            name:
              type: string
              description: AI model name
              example: sales-recommender-v2
            version:
              type: string
              description: Model version
              example: 2.1.0
            confidence:
              type: number
              format: double
              minimum: 0
              maximum: 1
              description: Overall model confidence
            parameters:
              type: object
              additionalProperties: true
              description: Model parameters used
        recommendations:
          type: array
          items:
            type: object
            properties:
              product:
                type: string
                description: Product ID
              productName:
                type: string
                description: Product name
              quantity:
                type: integer
                minimum: 1
                description: Recommended quantity
              price:
                type: number
                format: double
                minimum: 0
                description: Recommended price
              confidence:
                type: number
                format: double
                minimum: 0
                maximum: 1
                description: Confidence score for this recommendation
              reason:
                type: string
                description: AI reasoning for this recommendation
              category:
                type: string
                enum:
                  - frequent-buy
                  - seasonal
                  - cross-sell
                  - upsell
                  - new-product
                description: Recommendation category
              priority:
                type: integer
                minimum: 1
                maximum: 10
                description: Priority ranking
        insights:
          type: object
          properties:
            buyingPatterns:
              type: array
              items:
                type: string
              description: Identified buying patterns
            seasonality:
              type: object
              additionalProperties: true
              description: Seasonal trends identified
            riskFactors:
              type: array
              items:
                type: string
              description: Potential risks identified
            opportunities:
              type: array
              items:
                type: string
              description: Sales opportunities identified
        status:
          type: string
          enum:
            - processing
            - completed
            - failed
            - cancelled
          default: processing
          description: Processing status
        processingTime:
          type: number
          format: double
          description: Processing time in seconds
        accuracy:
          type: object
          properties:
            historical:
              type: number
              format: double
              minimum: 0
              maximum: 1
              description: Historical accuracy of similar predictions
            estimated:
              type: number
              format: double
              minimum: 0
              maximum: 1
              description: Estimated accuracy for this prediction
        feedback:
          type: object
          properties:
            userRating:
              type: integer
              minimum: 1
              maximum: 5
              description: User rating of recommendations
            acceptedRecommendations:
              type: array
              items:
                type: string
              description: IDs of accepted recommendations
            rejectedRecommendations:
              type: array
              items:
                type: string
              description: IDs of rejected recommendations
            comments:
              type: string
              description: User feedback comments
        generatedOrder:
          type: object
          properties:
            orderId:
              type: string
              description: Generated order ID if order was created
            items:
              type: array
              items:
                type: object
                properties:
                  product:
                    type: string
                  quantity:
                    type: integer
                  price:
                    type: number
                    format: double
            totalAmount:
              type: number
              format: double
              description: Total order amount
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - client
        - rep
        - activityType
    ActivityAiSalesOrderInput:
      type: object
      properties:
        client:
          type: string
          description: Client ID
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        rep:
          type: string
          description: Sales representative ID
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        activityType:
          type: string
          enum:
            - recommendation
            - order-analysis
            - demand-forecasting
            - cross-sell
            - upsell
          description: Type of AI activity
          example: recommendation
        inputData:
          type: object
          properties:
            historicalOrders:
              type: array
              items:
                type: object
                properties:
                  orderId:
                    type: string
                  date:
                    type: string
                    format: date-time
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        product:
                          type: string
                        quantity:
                          type: integer
                        price:
                          type: number
                          format: double
            clientPreferences:
              type: object
              additionalProperties: true
              description: Client preferences and behavior patterns
            marketData:
              type: object
              additionalProperties: true
              description: Market trends and seasonal data
            inventoryLevels:
              type: object
              additionalProperties: true
              description: Current inventory levels
        aiModel:
          type: object
          properties:
            name:
              type: string
              description: AI model name
              example: sales-recommender-v2
            version:
              type: string
              description: Model version
              example: 2.1.0
            parameters:
              type: object
              additionalProperties: true
              description: Model parameters used
        feedback:
          type: object
          properties:
            userRating:
              type: integer
              minimum: 1
              maximum: 5
              description: User rating of recommendations
            acceptedRecommendations:
              type: array
              items:
                type: string
              description: IDs of accepted recommendations
            rejectedRecommendations:
              type: array
              items:
                type: string
              description: IDs of rejected recommendations
            comments:
              type: string
              description: User feedback comments
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - client
        - rep
        - activityType
    ActivityFeedbackV2:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier
          example: 507f1f77bcf86cd799439011
        activity_type:
          type: string
          description: Type of activity this feedback is for
          example: sales_visit
        activity_id:
          type: string
          description: ID of the related activity
          example: 507f1f77bcf86cd799439012
        rep:
          type: string
          description: Representative ID
          example: 507f1f77bcf86cd799439013
        client:
          type: string
          description: Client ID
          example: 507f1f77bcf86cd799439014
        template_id:
          type: string
          description: Feedback template ID used
          example: 507f1f77bcf86cd799439015
        overall_satisfaction:
          type: integer
          description: Overall satisfaction rating (1-10 scale)
          minimum: 1
          maximum: 10
          example: 8
        responses:
          type: array
          items:
            type: object
            properties:
              question_id:
                type: string
                description: ID of the question
              question_text:
                type: string
                description: Text of the question
              question_type:
                type: string
                enum:
                  - rating
                  - multiple_choice
                  - text
                  - yes_no
                  - scale
              response_value:
                oneOf:
                  - type: string
                  - type: integer
                  - type: boolean
                description: The response value
              response_text:
                type: string
                description: Additional text response
        nps_score:
          type: integer
          description: Net Promoter Score (0-10)
          minimum: 0
          maximum: 10
          example: 9
        sentiment_analysis:
          type: object
          properties:
            overall_sentiment:
              type: string
              enum:
                - very_positive
                - positive
                - neutral
                - negative
                - very_negative
            confidence_score:
              type: number
              format: float
              minimum: 0
              maximum: 1
            keywords:
              type: array
              items:
                type: string
        completion_time:
          type: integer
          description: Time taken to complete feedback (in seconds)
          example: 180
        completion_rate:
          type: number
          format: float
          description: Percentage of questions completed
          example: 100
        session_data:
          type: object
          properties:
            device_type:
              type: string
              enum:
                - mobile
                - desktop
                - tablet
            browser:
              type: string
            ip_address:
              type: string
            location:
              type: object
              properties:
                country:
                  type: string
                city:
                  type: string
        follow_up_actions:
          type: array
          items:
            type: object
            properties:
              action_type:
                type: string
                enum:
                  - call
                  - email
                  - visit
                  - escalate
              priority:
                type: string
                enum:
                  - high
                  - medium
                  - low
              assigned_to:
                type: string
              due_date:
                type: string
                format: date
              status:
                type: string
                enum:
                  - pending
                  - in_progress
                  - completed
        is_anonymous:
          type: boolean
          description: Whether the feedback is anonymous
          example: false
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        modifiedAt:
          type: string
          format: date-time
          description: Last modification timestamp
        SVClient:
          type: integer
          description: Client version
        __v:
          type: integer
          description: Document version
      required:
        - activity_type
        - rep
        - template_id
        - overall_satisfaction
    CreateActivityFeedbackV2Request:
      type: object
      properties:
        activity_type:
          type: string
          description: Type of activity this feedback is for
          example: sales_visit
        activity_id:
          type: string
          description: ID of the related activity
          example: 507f1f77bcf86cd799439012
        rep:
          type: string
          description: Representative ID
          example: 507f1f77bcf86cd799439013
        client:
          type: string
          description: Client ID
          example: 507f1f77bcf86cd799439014
        template_id:
          type: string
          description: Feedback template ID used
          example: 507f1f77bcf86cd799439015
        overall_satisfaction:
          type: integer
          description: Overall satisfaction rating (1-10 scale)
          minimum: 1
          maximum: 10
          example: 8
        responses:
          type: array
          items:
            type: object
            properties:
              question_id:
                type: string
              question_type:
                type: string
                enum:
                  - rating
                  - multiple_choice
                  - text
                  - yes_no
                  - scale
              response_value:
                oneOf:
                  - type: string
                  - type: integer
                  - type: boolean
              response_text:
                type: string
        nps_score:
          type: integer
          description: Net Promoter Score (0-10)
          minimum: 0
          maximum: 10
        completion_time:
          type: integer
          description: Time taken to complete feedback (in seconds)
        session_data:
          type: object
          properties:
            device_type:
              type: string
              enum:
                - mobile
                - desktop
                - tablet
            browser:
              type: string
            ip_address:
              type: string
        is_anonymous:
          type: boolean
          description: Whether the feedback is anonymous
          default: false
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
      required:
        - activity_type
        - rep
        - template_id
        - overall_satisfaction
    UpdateActivityFeedbackV2Request:
      type: object
      properties:
        overall_satisfaction:
          type: integer
          description: Overall satisfaction rating (1-10 scale)
          minimum: 1
          maximum: 10
        responses:
          type: array
          items:
            type: object
            properties:
              question_id:
                type: string
              question_type:
                type: string
                enum:
                  - rating
                  - multiple_choice
                  - text
                  - yes_no
                  - scale
              response_value:
                oneOf:
                  - type: string
                  - type: integer
                  - type: boolean
              response_text:
                type: string
        nps_score:
          type: integer
          description: Net Promoter Score (0-10)
          minimum: 0
          maximum: 10
        follow_up_actions:
          type: array
          items:
            type: object
            properties:
              action_type:
                type: string
                enum:
                  - call
                  - email
                  - visit
                  - escalate
              priority:
                type: string
                enum:
                  - high
                  - medium
                  - low
              assigned_to:
                type: string
              due_date:
                type: string
                format: date
              status:
                type: string
                enum:
                  - pending
                  - in_progress
                  - completed
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
    PagingInfo:
      type: object
      properties:
        total:
          type: integer
          description: Total number of items
        page:
          type: integer
          description: Current page number
        per_page:
          type: integer
          description: Items per page
        pages:
          type: integer
          description: Total number of pages
    ActivityFeedback:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier
          example: 507f1f77bcf86cd799439011
        activity_type:
          type: string
          description: Type of activity this feedback is for
          example: sales_visit
        activity_id:
          type: string
          description: ID of the related activity
          example: 507f1f77bcf86cd799439012
        rep:
          type: string
          description: Representative ID
          example: 507f1f77bcf86cd799439013
        client:
          type: string
          description: Client ID
          example: 507f1f77bcf86cd799439014
        rating:
          type: integer
          description: Feedback rating (1-5 scale)
          minimum: 1
          maximum: 5
          example: 4
        feedback_text:
          type: string
          description: Detailed feedback text
          example: Great service, very professional
        feedback_categories:
          type: array
          items:
            type: string
          description: Categories of feedback
          example:
            - service_quality
            - timeliness
            - professionalism
        sentiment:
          type: string
          description: Overall sentiment of the feedback
          enum:
            - positive
            - neutral
            - negative
          example: positive
        is_anonymous:
          type: boolean
          description: Whether the feedback is anonymous
          example: false
        source:
          type: string
          description: Source of the feedback
          enum:
            - mobile_app
            - web_portal
            - email
            - sms
            - phone
          example: mobile_app
        response_time:
          type: integer
          description: Time taken to provide feedback (in seconds)
          example: 120
        attachments:
          type: array
          items:
            type: object
            properties:
              file_url:
                type: string
                description: URL to attached file
              file_type:
                type: string
                description: Type of attached file
              file_size:
                type: integer
                description: Size of attached file in bytes
        follow_up_required:
          type: boolean
          description: Whether follow-up is required
          example: false
        follow_up_notes:
          type: string
          description: Notes for follow-up actions
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        modifiedAt:
          type: string
          format: date-time
          description: Last modification timestamp
        SVClient:
          type: integer
          description: Client version
        __v:
          type: integer
          description: Document version
      required:
        - activity_type
        - rep
        - rating
    CreateActivityFeedbackRequest:
      type: object
      properties:
        activity_type:
          type: string
          description: Type of activity this feedback is for
          example: sales_visit
        activity_id:
          type: string
          description: ID of the related activity
          example: 507f1f77bcf86cd799439012
        rep:
          type: string
          description: Representative ID
          example: 507f1f77bcf86cd799439013
        client:
          type: string
          description: Client ID
          example: 507f1f77bcf86cd799439014
        rating:
          type: integer
          description: Feedback rating (1-5 scale)
          minimum: 1
          maximum: 5
          example: 4
        feedback_text:
          type: string
          description: Detailed feedback text
          example: Great service, very professional
        feedback_categories:
          type: array
          items:
            type: string
          description: Categories of feedback
        is_anonymous:
          type: boolean
          description: Whether the feedback is anonymous
          default: false
        source:
          type: string
          description: Source of the feedback
          enum:
            - mobile_app
            - web_portal
            - email
            - sms
            - phone
          default: mobile_app
        response_time:
          type: integer
          description: Time taken to provide feedback (in seconds)
        attachments:
          type: array
          items:
            type: object
            properties:
              file_url:
                type: string
              file_type:
                type: string
              file_size:
                type: integer
        follow_up_required:
          type: boolean
          description: Whether follow-up is required
          default: false
        follow_up_notes:
          type: string
          description: Notes for follow-up actions
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
      required:
        - activity_type
        - rep
        - rating
    UpdateActivityFeedbackRequest:
      type: object
      properties:
        rating:
          type: integer
          description: Feedback rating (1-5 scale)
          minimum: 1
          maximum: 5
        feedback_text:
          type: string
          description: Detailed feedback text
        feedback_categories:
          type: array
          items:
            type: string
          description: Categories of feedback
        follow_up_required:
          type: boolean
          description: Whether follow-up is required
        follow_up_notes:
          type: string
          description: Notes for follow-up actions
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
    ActivityStorecheck:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the activity storecheck record
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        client:
          type: string
          description: Client identifier
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        rep:
          type: string
          description: Sales representative identifier
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        template:
          type: string
          description: Storecheck template identifier
          example: 60f7b1b3e4b0e8b3f8b3f8b6
        date:
          type: string
          format: date-time
          description: Date and time of the storecheck activity
          example: "2023-01-15T10:30:00Z"
        location:
          type: object
          properties:
            latitude:
              type: number
              format: double
              description: Latitude coordinate
              example: 40.7128
            longitude:
              type: number
              format: double
              description: Longitude coordinate
              example: -74.006
        responses:
          type: array
          items:
            type: object
            properties:
              questionId:
                type: string
                description: Question identifier
              answer:
                type: string
                description: Answer to the question
              photos:
                type: array
                items:
                  type: string
                  description: Photo URLs
        status:
          type: string
          enum:
            - draft
            - submitted
            - approved
            - rejected
          default: draft
          description: Status of the storecheck activity
        notes:
          type: string
          description: Additional notes
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - client
        - rep
        - template
        - date
    ActivityStorecheckInput:
      type: object
      properties:
        client:
          type: string
          description: Client identifier
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        rep:
          type: string
          description: Sales representative identifier
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        template:
          type: string
          description: Storecheck template identifier
          example: 60f7b1b3e4b0e8b3f8b3f8b6
        date:
          type: string
          format: date-time
          description: Date and time of the storecheck activity
          example: "2023-01-15T10:30:00Z"
        location:
          type: object
          properties:
            latitude:
              type: number
              format: double
              description: Latitude coordinate
              example: 40.7128
            longitude:
              type: number
              format: double
              description: Longitude coordinate
              example: -74.006
        responses:
          type: array
          items:
            type: object
            properties:
              questionId:
                type: string
                description: Question identifier
              answer:
                type: string
                description: Answer to the question
              photos:
                type: array
                items:
                  type: string
                  description: Photo URLs
        status:
          type: string
          enum:
            - draft
            - submitted
            - approved
            - rejected
          default: draft
          description: Status of the storecheck activity
        notes:
          type: string
          description: Additional notes
      required:
        - client
        - rep
        - template
        - date
    AdjustAccountFindResult:
      type: object
      description: Result of finding account adjustments
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/AdjustAccountSchema"
        total_result:
          type: number
          description: Total number of account adjustments
        current_count:
          type: number
          description: Count of account adjustments in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of account adjustments per page
    AdjustAccountSchema:
      type: object
      description: Account adjustment schema
      properties:
        _id:
          type: string
          description: Unique identifier for the account adjustment
        client:
          type: string
          description: Client ID whose account is being adjusted
        rep:
          type: string
          description: Representative ID who made the adjustment
        type:
          type: string
          enum:
            - credit
            - debit
          description: Type of adjustment (credit increases balance, debit decreases)
        amount:
          type: number
          description: Adjustment amount
        reason:
          type: string
          description: Reason for the adjustment
        reference:
          type: string
          description: Reference number or document
        description:
          type: string
          description: Detailed description of the adjustment
        previousBalance:
          type: number
          description: Account balance before adjustment
        newBalance:
          type: number
          description: Account balance after adjustment
        adjustmentDate:
          type: string
          format: date-time
          description: Date when adjustment was made
        approvedBy:
          type: string
          description: ID of user who approved the adjustment
        approvalDate:
          type: string
          format: date-time
          description: Date when adjustment was approved
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    AdjustAccountCreateBody:
      type: object
      description: Body for creating an account adjustment
      required:
        - client
        - type
        - amount
        - reason
      properties:
        client:
          type: string
          description: Client ID whose account is being adjusted
        rep:
          type: string
          description: Representative ID who made the adjustment
        type:
          type: string
          enum:
            - credit
            - debit
          description: Type of adjustment (credit increases balance, debit decreases)
        amount:
          type: number
          description: Adjustment amount
        reason:
          type: string
          description: Reason for the adjustment
        reference:
          type: string
          description: Reference number or document
        description:
          type: string
          description: Detailed description of the adjustment
        adjustmentDate:
          type: string
          format: date-time
          description: Date when adjustment was made
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    AdjustAccountCreateResult:
      $ref: "#/components/schemas/AdjustAccountSchema"
      description: Result of creating an account adjustment
    AdjustAccountGetResult:
      $ref: "#/components/schemas/AdjustAccountSchema"
      description: Result of getting an account adjustment
    InventoryAdjustmentFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/InventoryAdjustment"
        meta:
          type: object
    InventoryAdjustmentCreateBody:
      type: object
      properties:
        warehouse:
          type: string
        rep:
          type: string
        items:
          type: array
          items:
            type: object
            properties:
              product:
                type: string
              variant:
                type: string
              adjustmentQuantity:
                type: number
              reason:
                type: string
        notes:
          type: string
    InventoryAdjustmentCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/InventoryAdjustment"
    InventoryAdjustmentGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/InventoryAdjustment"
    InventoryAdjustment:
      type: object
      properties:
        _id:
          type: string
        warehouse:
          type: string
        rep:
          type: string
        items:
          type: array
          items:
            type: object
            properties:
              product:
                type: string
              variant:
                type: string
              adjustmentQuantity:
                type: number
              reason:
                type: string
        notes:
          type: string
        status:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    ApprovalRequestFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/ApprovalRequest"
        meta:
          type: object
    ApprovalRequestCreateBody:
      type: object
      properties:
        title:
          type: string
        description:
          type: string
        requestedBy:
          type: string
        entity:
          type: string
        entityId:
          type: string
        approvers:
          type: array
          items:
            type: string
        requiredApprovals:
          type: number
        dueDate:
          type: string
          format: date-time
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
    ApprovalRequestCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/ApprovalRequest"
    ApprovalRequestGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/ApprovalRequest"
    ApprovalRequestUpdateBody:
      type: object
      properties:
        title:
          type: string
        description:
          type: string
        approvers:
          type: array
          items:
            type: string
        requiredApprovals:
          type: number
        dueDate:
          type: string
          format: date-time
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
        status:
          type: string
    ApprovalRequestUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/ApprovalRequest"
    ApprovalRequestRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    ApprovalRequest:
      type: object
      properties:
        _id:
          type: string
        title:
          type: string
        description:
          type: string
        requestedBy:
          type: string
        entity:
          type: string
        entityId:
          type: string
        approvers:
          type: array
          items:
            type: string
        requiredApprovals:
          type: number
        currentApprovals:
          type: number
        dueDate:
          type: string
          format: date-time
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
        status:
          type: string
          enum:
            - pending
            - approved
            - rejected
            - expired
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    ApprovalFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Approval"
        meta:
          type: object
    ApprovalCreateBody:
      type: object
      properties:
        approvalRequest:
          type: string
        approver:
          type: string
        decision:
          type: string
          enum:
            - approved
            - rejected
        comments:
          type: string
        signedAt:
          type: string
          format: date-time
    ApprovalCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Approval"
    ApprovalGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Approval"
    ApprovalUpdateBody:
      type: object
      properties:
        decision:
          type: string
          enum:
            - approved
            - rejected
        comments:
          type: string
        signedAt:
          type: string
          format: date-time
    ApprovalUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Approval"
    ApprovalRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    Approval:
      type: object
      properties:
        _id:
          type: string
        approvalRequest:
          type: string
        approver:
          type: string
        decision:
          type: string
          enum:
            - approved
            - rejected
            - pending
        comments:
          type: string
        signedAt:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    AssetPartReceival:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the asset part receival
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        receivalNumber:
          type: string
          description: Unique receival number
          example: RCV-2023-001
        purchaseOrder:
          type: string
          description: Purchase order reference
          example: PO-2023-001
        supplier:
          type: string
          description: Supplier ID
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        receivalDate:
          type: string
          format: date-time
          description: Date and time of receival
          example: "2023-01-15T10:00:00Z"
        expectedDate:
          type: string
          format: date-time
          description: Expected delivery date
          example: "2023-01-14T10:00:00Z"
        receivedBy:
          type: string
          description: User who received the parts
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        warehouse:
          type: string
          description: Warehouse ID where parts were received
          example: 60f7b1b3e4b0e8b3f8b3f8b6
        status:
          type: string
          enum:
            - pending
            - partial
            - complete
            - cancelled
          default: pending
          description: Status of the receival
        items:
          type: array
          items:
            type: object
            properties:
              assetPart:
                type: string
                description: Asset part ID
              orderedQuantity:
                type: integer
                minimum: 1
                description: Quantity ordered
              receivedQuantity:
                type: integer
                minimum: 0
                description: Quantity actually received
              unitCost:
                type: number
                format: double
                minimum: 0
                description: Cost per unit
              totalCost:
                type: number
                format: double
                minimum: 0
                description: Total cost for this item
              condition:
                type: string
                enum:
                  - new
                  - good
                  - damaged
                  - defective
                default: new
                description: Condition of received items
              batchNumber:
                type: string
                description: Batch number
              serialNumbers:
                type: array
                items:
                  type: string
                description: Serial numbers for tracked items
              expiryDate:
                type: string
                format: date
                description: Expiry date if applicable
              notes:
                type: string
                description: Notes for this item
        totalValue:
          type: number
          format: double
          minimum: 0
          description: Total value of the receival
        currency:
          type: string
          description: Currency code
          example: USD
        shippingCost:
          type: number
          format: double
          minimum: 0
          description: Shipping cost
        taxAmount:
          type: number
          format: double
          minimum: 0
          description: Tax amount
        discountAmount:
          type: number
          format: double
          minimum: 0
          description: Discount amount
        invoice:
          type: object
          properties:
            number:
              type: string
              description: Invoice number
            date:
              type: string
              format: date
              description: Invoice date
            amount:
              type: number
              format: double
              minimum: 0
              description: Invoice amount
        qualityCheck:
          type: object
          properties:
            performed:
              type: boolean
              default: false
              description: Whether quality check was performed
            checkedBy:
              type: string
              description: User who performed quality check
            checkDate:
              type: string
              format: date-time
              description: Quality check date
            passed:
              type: boolean
              description: Whether quality check passed
            notes:
              type: string
              description: Quality check notes
        documents:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              url:
                type: string
                format: uri
              type:
                type: string
                enum:
                  - invoice
                  - packing-slip
                  - quality-certificate
                  - photo
        notes:
          type: string
          description: General notes
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - receivalNumber
        - supplier
        - receivalDate
        - items
    AssetPartReceivalInput:
      type: object
      properties:
        receivalNumber:
          type: string
          description: Unique receival number
          example: RCV-2023-001
        purchaseOrder:
          type: string
          description: Purchase order reference
          example: PO-2023-001
        supplier:
          type: string
          description: Supplier ID
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        receivalDate:
          type: string
          format: date-time
          description: Date and time of receival
          example: "2023-01-15T10:00:00Z"
        expectedDate:
          type: string
          format: date-time
          description: Expected delivery date
          example: "2023-01-14T10:00:00Z"
        receivedBy:
          type: string
          description: User who received the parts
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        warehouse:
          type: string
          description: Warehouse ID where parts were received
          example: 60f7b1b3e4b0e8b3f8b3f8b6
        status:
          type: string
          enum:
            - pending
            - partial
            - complete
            - cancelled
          default: pending
          description: Status of the receival
        items:
          type: array
          items:
            type: object
            properties:
              assetPart:
                type: string
                description: Asset part ID
              orderedQuantity:
                type: integer
                minimum: 1
                description: Quantity ordered
              receivedQuantity:
                type: integer
                minimum: 0
                description: Quantity actually received
              unitCost:
                type: number
                format: double
                minimum: 0
                description: Cost per unit
              totalCost:
                type: number
                format: double
                minimum: 0
                description: Total cost for this item
              condition:
                type: string
                enum:
                  - new
                  - good
                  - damaged
                  - defective
                default: new
                description: Condition of received items
              batchNumber:
                type: string
                description: Batch number
              serialNumbers:
                type: array
                items:
                  type: string
                description: Serial numbers for tracked items
              expiryDate:
                type: string
                format: date
                description: Expiry date if applicable
              notes:
                type: string
                description: Notes for this item
        totalValue:
          type: number
          format: double
          minimum: 0
          description: Total value of the receival
        currency:
          type: string
          description: Currency code
          example: USD
        shippingCost:
          type: number
          format: double
          minimum: 0
          description: Shipping cost
        taxAmount:
          type: number
          format: double
          minimum: 0
          description: Tax amount
        discountAmount:
          type: number
          format: double
          minimum: 0
          description: Discount amount
        invoice:
          type: object
          properties:
            number:
              type: string
              description: Invoice number
            date:
              type: string
              format: date
              description: Invoice date
            amount:
              type: number
              format: double
              minimum: 0
              description: Invoice amount
        qualityCheck:
          type: object
          properties:
            performed:
              type: boolean
              default: false
              description: Whether quality check was performed
            checkedBy:
              type: string
              description: User who performed quality check
            checkDate:
              type: string
              format: date-time
              description: Quality check date
            passed:
              type: boolean
              description: Whether quality check passed
            notes:
              type: string
              description: Quality check notes
        documents:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              url:
                type: string
                format: uri
              type:
                type: string
                enum:
                  - invoice
                  - packing-slip
                  - quality-certificate
                  - photo
        notes:
          type: string
          description: General notes
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - receivalNumber
        - supplier
        - receivalDate
        - items
    AssetPartTransfer:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the asset part transfer
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        transferNumber:
          type: string
          description: Unique transfer number
          example: TRF-2023-001
        fromLocation:
          type: object
          properties:
            warehouse:
              type: string
              description: Source warehouse ID
            section:
              type: string
              description: Source section
            shelf:
              type: string
              description: Source shelf
            position:
              type: string
              description: Source position
        toLocation:
          type: object
          properties:
            warehouse:
              type: string
              description: Destination warehouse ID
            section:
              type: string
              description: Destination section
            shelf:
              type: string
              description: Destination shelf
            position:
              type: string
              description: Destination position
        requestedBy:
          type: string
          description: User who requested the transfer
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        approvedBy:
          type: string
          description: User who approved the transfer
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        transferredBy:
          type: string
          description: User who executed the transfer
          example: 60f7b1b3e4b0e8b3f8b3f8b6
        requestDate:
          type: string
          format: date-time
          description: Date when transfer was requested
          example: "2023-01-15T08:00:00Z"
        approvalDate:
          type: string
          format: date-time
          description: Date when transfer was approved
          example: "2023-01-15T09:00:00Z"
        transferDate:
          type: string
          format: date-time
          description: Date when transfer was executed
          example: "2023-01-15T10:00:00Z"
        scheduledDate:
          type: string
          format: date-time
          description: Scheduled transfer date
          example: "2023-01-15T10:00:00Z"
        status:
          type: string
          enum:
            - requested
            - approved
            - in-progress
            - completed
            - cancelled
          default: requested
          description: Status of the transfer
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
          default: medium
          description: Priority of the transfer
        reason:
          type: string
          description: Reason for the transfer
        items:
          type: array
          items:
            type: object
            properties:
              assetPartUnit:
                type: string
                description: Asset part unit ID
              assetPart:
                type: string
                description: Asset part ID
              serialNumber:
                type: string
                description: Serial number
              quantity:
                type: integer
                minimum: 1
                description: Quantity to transfer
              condition:
                type: string
                enum:
                  - new
                  - good
                  - fair
                  - poor
                  - damaged
                description: Condition at transfer
              notes:
                type: string
                description: Notes for this item
        totalItems:
          type: integer
          minimum: 0
          description: Total number of items being transferred
        transportMethod:
          type: string
          enum:
            - manual
            - vehicle
            - courier
            - automated
          default: manual
          description: Method of transport
        carrier:
          type: string
          description: Carrier/transporter name
        trackingNumber:
          type: string
          description: Tracking number if applicable
        estimatedArrival:
          type: string
          format: date-time
          description: Estimated arrival time
        actualArrival:
          type: string
          format: date-time
          description: Actual arrival time
        cost:
          type: number
          format: double
          minimum: 0
          description: Transfer cost
        currency:
          type: string
          description: Currency code
          example: USD
        documents:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              url:
                type: string
                format: uri
              type:
                type: string
                enum:
                  - transfer-order
                  - receipt
                  - photo
                  - other
        notes:
          type: string
          description: General notes
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - transferNumber
        - fromLocation
        - toLocation
        - requestedBy
        - items
    AssetPartTransferInput:
      type: object
      properties:
        transferNumber:
          type: string
          description: Unique transfer number
          example: TRF-2023-001
        fromLocation:
          type: object
          properties:
            warehouse:
              type: string
              description: Source warehouse ID
            section:
              type: string
              description: Source section
            shelf:
              type: string
              description: Source shelf
            position:
              type: string
              description: Source position
        toLocation:
          type: object
          properties:
            warehouse:
              type: string
              description: Destination warehouse ID
            section:
              type: string
              description: Destination section
            shelf:
              type: string
              description: Destination shelf
            position:
              type: string
              description: Destination position
        requestedBy:
          type: string
          description: User who requested the transfer
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        approvedBy:
          type: string
          description: User who approved the transfer
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        transferredBy:
          type: string
          description: User who executed the transfer
          example: 60f7b1b3e4b0e8b3f8b3f8b6
        requestDate:
          type: string
          format: date-time
          description: Date when transfer was requested
          example: "2023-01-15T08:00:00Z"
        approvalDate:
          type: string
          format: date-time
          description: Date when transfer was approved
          example: "2023-01-15T09:00:00Z"
        transferDate:
          type: string
          format: date-time
          description: Date when transfer was executed
          example: "2023-01-15T10:00:00Z"
        scheduledDate:
          type: string
          format: date-time
          description: Scheduled transfer date
          example: "2023-01-15T10:00:00Z"
        status:
          type: string
          enum:
            - requested
            - approved
            - in-progress
            - completed
            - cancelled
          default: requested
          description: Status of the transfer
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
          default: medium
          description: Priority of the transfer
        reason:
          type: string
          description: Reason for the transfer
        items:
          type: array
          items:
            type: object
            properties:
              assetPartUnit:
                type: string
                description: Asset part unit ID
              assetPart:
                type: string
                description: Asset part ID
              serialNumber:
                type: string
                description: Serial number
              quantity:
                type: integer
                minimum: 1
                description: Quantity to transfer
              condition:
                type: string
                enum:
                  - new
                  - good
                  - fair
                  - poor
                  - damaged
                description: Condition at transfer
              notes:
                type: string
                description: Notes for this item
        totalItems:
          type: integer
          minimum: 0
          description: Total number of items being transferred
        transportMethod:
          type: string
          enum:
            - manual
            - vehicle
            - courier
            - automated
          default: manual
          description: Method of transport
        carrier:
          type: string
          description: Carrier/transporter name
        trackingNumber:
          type: string
          description: Tracking number if applicable
        estimatedArrival:
          type: string
          format: date-time
          description: Estimated arrival time
        actualArrival:
          type: string
          format: date-time
          description: Actual arrival time
        cost:
          type: number
          format: double
          minimum: 0
          description: Transfer cost
        currency:
          type: string
          description: Currency code
          example: USD
        documents:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              url:
                type: string
                format: uri
              type:
                type: string
                enum:
                  - transfer-order
                  - receipt
                  - photo
                  - other
        notes:
          type: string
          description: General notes
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - transferNumber
        - fromLocation
        - toLocation
        - requestedBy
        - items
    AssetPartType:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the asset part type
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        name:
          type: string
          description: Name of the asset part type
          example: Engine Parts
        description:
          type: string
          description: Description of the asset part type
        category:
          type: string
          description: Category of the asset part type
          example: Mechanical
        subcategory:
          type: string
          description: Subcategory of the asset part type
        specifications:
          type: object
          additionalProperties: true
          description: Technical specifications
          example:
            material: Steel
            dimensions: 10x5x2 cm
            weight: 0.5 kg
        compatibleAssetTypes:
          type: array
          items:
            type: string
          description: List of compatible asset type IDs
        maintenanceSchedule:
          type: object
          properties:
            frequency:
              type: string
              enum:
                - daily
                - weekly
                - monthly
                - quarterly
                - annually
            intervalDays:
              type: integer
              minimum: 1
            description:
              type: string
        warrantPeriod:
          type: integer
          description: Warranty period in days
          example: 365
        supplier:
          type: string
          description: Default supplier ID
        standardCost:
          type: number
          format: double
          minimum: 0
          description: Standard cost of the part
        isActive:
          type: boolean
          default: true
          description: Whether the part type is active
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - name
        - category
    AssetPartTypeInput:
      type: object
      properties:
        name:
          type: string
          description: Name of the asset part type
          example: Engine Parts
        description:
          type: string
          description: Description of the asset part type
        category:
          type: string
          description: Category of the asset part type
          example: Mechanical
        subcategory:
          type: string
          description: Subcategory of the asset part type
        specifications:
          type: object
          additionalProperties: true
          description: Technical specifications
          example:
            material: Steel
            dimensions: 10x5x2 cm
            weight: 0.5 kg
        compatibleAssetTypes:
          type: array
          items:
            type: string
          description: List of compatible asset type IDs
        maintenanceSchedule:
          type: object
          properties:
            frequency:
              type: string
              enum:
                - daily
                - weekly
                - monthly
                - quarterly
                - annually
            intervalDays:
              type: integer
              minimum: 1
            description:
              type: string
        warrantPeriod:
          type: integer
          description: Warranty period in days
          example: 365
        supplier:
          type: string
          description: Default supplier ID
        standardCost:
          type: number
          format: double
          minimum: 0
          description: Standard cost of the part
        isActive:
          type: boolean
          default: true
          description: Whether the part type is active
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - name
        - category
    AssetPartUnit:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the asset part unit
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        serialNumber:
          type: string
          description: Serial number of the part unit
          example: SN-EP001-2023-001
        assetPart:
          type: string
          description: Asset part ID this unit belongs to
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        batchNumber:
          type: string
          description: Batch number
          example: BATCH-2023-001
        lotNumber:
          type: string
          description: Lot number
        manufactureDate:
          type: string
          format: date
          description: Manufacturing date
          example: "2023-01-15"
        expiryDate:
          type: string
          format: date
          description: Expiry date (if applicable)
        receiptDate:
          type: string
          format: date-time
          description: Date when the unit was received
          example: "2023-01-20T10:00:00Z"
        status:
          type: string
          enum:
            - available
            - reserved
            - in-use
            - maintenance
            - disposed
            - returned
          default: available
          description: Current status of the part unit
        condition:
          type: string
          enum:
            - new
            - good
            - fair
            - poor
            - damaged
          default: new
          description: Physical condition of the part unit
        location:
          type: object
          properties:
            warehouse:
              type: string
              description: Warehouse ID
            section:
              type: string
              description: Section within warehouse
            shelf:
              type: string
              description: Shelf identifier
            position:
              type: string
              description: Position on shelf
        assignedTo:
          type: object
          properties:
            asset:
              type: string
              description: Asset ID if installed
            workOrder:
              type: string
              description: Work order ID if assigned
            technician:
              type: string
              description: Technician ID if assigned
            date:
              type: string
              format: date-time
              description: Assignment date
        installationDate:
          type: string
          format: date-time
          description: Date when the unit was installed
        lastMaintenanceDate:
          type: string
          format: date-time
          description: Last maintenance date
        nextMaintenanceDate:
          type: string
          format: date-time
          description: Next scheduled maintenance date
        warrantyExpiry:
          type: string
          format: date
          description: Warranty expiry date
        cost:
          type: number
          format: double
          minimum: 0
          description: Cost of this specific unit
        supplier:
          type: string
          description: Supplier ID
        purchaseOrder:
          type: string
          description: Purchase order reference
        invoice:
          type: string
          description: Invoice reference
        notes:
          type: string
          description: Additional notes
        maintenanceHistory:
          type: array
          items:
            type: object
            properties:
              date:
                type: string
                format: date-time
              type:
                type: string
                enum:
                  - inspection
                  - repair
                  - replacement
                  - upgrade
              description:
                type: string
              technician:
                type: string
              cost:
                type: number
                format: double
        customFields:
          type: object
          additionalProperties: true
          description: Custom fields
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - serialNumber
        - assetPart
        - status
    AssetPartUnitInput:
      type: object
      properties:
        serialNumber:
          type: string
          description: Serial number of the part unit
          example: SN-EP001-2023-001
        assetPart:
          type: string
          description: Asset part ID this unit belongs to
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        batchNumber:
          type: string
          description: Batch number
          example: BATCH-2023-001
        lotNumber:
          type: string
          description: Lot number
        manufactureDate:
          type: string
          format: date
          description: Manufacturing date
          example: "2023-01-15"
        expiryDate:
          type: string
          format: date
          description: Expiry date (if applicable)
        receiptDate:
          type: string
          format: date-time
          description: Date when the unit was received
          example: "2023-01-20T10:00:00Z"
        status:
          type: string
          enum:
            - available
            - reserved
            - in-use
            - maintenance
            - disposed
            - returned
          default: available
          description: Current status of the part unit
        condition:
          type: string
          enum:
            - new
            - good
            - fair
            - poor
            - damaged
          default: new
          description: Physical condition of the part unit
        location:
          type: object
          properties:
            warehouse:
              type: string
              description: Warehouse ID
            section:
              type: string
              description: Section within warehouse
            shelf:
              type: string
              description: Shelf identifier
            position:
              type: string
              description: Position on shelf
        assignedTo:
          type: object
          properties:
            asset:
              type: string
              description: Asset ID if installed
            workOrder:
              type: string
              description: Work order ID if assigned
            technician:
              type: string
              description: Technician ID if assigned
            date:
              type: string
              format: date-time
              description: Assignment date
        installationDate:
          type: string
          format: date-time
          description: Date when the unit was installed
        lastMaintenanceDate:
          type: string
          format: date-time
          description: Last maintenance date
        nextMaintenanceDate:
          type: string
          format: date-time
          description: Next scheduled maintenance date
        warrantyExpiry:
          type: string
          format: date
          description: Warranty expiry date
        cost:
          type: number
          format: double
          minimum: 0
          description: Cost of this specific unit
        supplier:
          type: string
          description: Supplier ID
        purchaseOrder:
          type: string
          description: Purchase order reference
        invoice:
          type: string
          description: Invoice reference
        notes:
          type: string
          description: Additional notes
        customFields:
          type: object
          additionalProperties: true
          description: Custom fields
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - serialNumber
        - assetPart
        - status
    AssetPart:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the asset part
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        partNumber:
          type: string
          description: Unique part number
          example: EP-001-2023
        name:
          type: string
          description: Name of the asset part
          example: Engine Valve
        description:
          type: string
          description: Description of the asset part
        partType:
          type: string
          description: Asset part type ID
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        manufacturer:
          type: string
          description: Manufacturer name
          example: ABC Manufacturing
        model:
          type: string
          description: Part model number
        specifications:
          type: object
          additionalProperties: true
          description: Technical specifications
          example:
            material: Stainless Steel
            diameter: 25mm
            length: 50mm
        compatibleAssets:
          type: array
          items:
            type: string
          description: List of compatible asset IDs
        supplier:
          type: string
          description: Primary supplier ID
        cost:
          type: number
          format: double
          minimum: 0
          description: Current cost of the part
        currency:
          type: string
          description: Currency code
          example: USD
        minStockLevel:
          type: integer
          minimum: 0
          description: Minimum stock level
        maxStockLevel:
          type: integer
          minimum: 0
          description: Maximum stock level
        reorderPoint:
          type: integer
          minimum: 0
          description: Reorder point threshold
        leadTime:
          type: integer
          description: Lead time in days
          example: 7
        warrantyPeriod:
          type: integer
          description: Warranty period in days
          example: 365
        category:
          type: string
          description: Part category
          example: Engine
        subcategory:
          type: string
          description: Part subcategory
          example: Valves
        isActive:
          type: boolean
          default: true
          description: Whether the part is active
        barcode:
          type: string
          description: Barcode for the part
        qrCode:
          type: string
          description: QR code for the part
        images:
          type: array
          items:
            type: string
            format: uri
          description: Part images URLs
        documents:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              url:
                type: string
                format: uri
              type:
                type: string
                enum:
                  - manual
                  - specification
                  - certificate
                  - warranty
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - partNumber
        - name
        - partType
    AssetPartInput:
      type: object
      properties:
        partNumber:
          type: string
          description: Unique part number
          example: EP-001-2023
        name:
          type: string
          description: Name of the asset part
          example: Engine Valve
        description:
          type: string
          description: Description of the asset part
        partType:
          type: string
          description: Asset part type ID
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        manufacturer:
          type: string
          description: Manufacturer name
          example: ABC Manufacturing
        model:
          type: string
          description: Part model number
        specifications:
          type: object
          additionalProperties: true
          description: Technical specifications
          example:
            material: Stainless Steel
            diameter: 25mm
            length: 50mm
        compatibleAssets:
          type: array
          items:
            type: string
          description: List of compatible asset IDs
        supplier:
          type: string
          description: Primary supplier ID
        cost:
          type: number
          format: double
          minimum: 0
          description: Current cost of the part
        currency:
          type: string
          description: Currency code
          example: USD
        minStockLevel:
          type: integer
          minimum: 0
          description: Minimum stock level
        maxStockLevel:
          type: integer
          minimum: 0
          description: Maximum stock level
        reorderPoint:
          type: integer
          minimum: 0
          description: Reorder point threshold
        leadTime:
          type: integer
          description: Lead time in days
          example: 7
        warrantyPeriod:
          type: integer
          description: Warranty period in days
          example: 365
        category:
          type: string
          description: Part category
          example: Engine
        subcategory:
          type: string
          description: Part subcategory
          example: Valves
        isActive:
          type: boolean
          default: true
          description: Whether the part is active
        barcode:
          type: string
          description: Barcode for the part
        qrCode:
          type: string
          description: QR code for the part
        images:
          type: array
          items:
            type: string
            format: uri
          description: Part images URLs
        documents:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              url:
                type: string
                format: uri
              type:
                type: string
                enum:
                  - manual
                  - specification
                  - certificate
                  - warranty
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - partNumber
        - name
        - partType
    AssetTypeFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/AssetType"
        meta:
          type: object
    AssetTypeCreateBody:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        category:
          type: string
        fields:
          type: array
          items:
            type: object
        disabled:
          type: boolean
    AssetTypeCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/AssetType"
    AssetTypeGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/AssetType"
    AssetTypeUpdateBody:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        category:
          type: string
        fields:
          type: array
          items:
            type: object
        disabled:
          type: boolean
    AssetTypeUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/AssetType"
    AssetTypeRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    AssetType:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        description:
          type: string
        category:
          type: string
        fields:
          type: array
          items:
            type: object
        disabled:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    AssetUnit:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier
          example: 507f1f77bcf86cd799439011
        asset:
          type: string
          description: Asset ID reference
          example: 507f1f77bcf86cd799439012
        serial_number:
          type: string
          description: Unique serial number for this unit
          example: AST-001-2024
        barcode:
          type: string
          description: Barcode identifier
          example: "123456789012"
        status:
          type: string
          description: Current status of the asset unit
          enum:
            - active
            - maintenance
            - retired
            - disposed
          example: active
        condition:
          type: string
          description: Physical condition of the asset
          enum:
            - excellent
            - good
            - fair
            - poor
          example: good
        location:
          type: string
          description: Current location of the asset unit
          example: Warehouse A, Section 2
        assigned_to:
          type: string
          description: User or department assigned to this asset
          example: 507f1f77bcf86cd799439013
        purchase_date:
          type: string
          format: date
          description: Date when the asset unit was purchased
        warranty_expiry:
          type: string
          format: date
          description: Warranty expiration date
        last_maintenance:
          type: string
          format: date-time
          description: Date of last maintenance
        next_maintenance:
          type: string
          format: date
          description: Date of next scheduled maintenance
        purchase_cost:
          type: number
          format: float
          description: Original purchase cost
          example: 1500
        depreciation:
          type: object
          properties:
            method:
              type: string
              enum:
                - straight-line
                - declining-balance
                - sum-of-years
            rate:
              type: number
              format: float
            current_value:
              type: number
              format: float
        maintenance_history:
          type: array
          items:
            type: object
            properties:
              date:
                type: string
                format: date-time
              type:
                type: string
                enum:
                  - routine
                  - repair
                  - inspection
                  - upgrade
              description:
                type: string
              cost:
                type: number
                format: float
              performed_by:
                type: string
        notes:
          type: string
          description: Additional notes about the asset unit
        custom_fields:
          type: object
          description: Custom fields for additional data
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the asset unit is disabled
          example: false
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        modifiedAt:
          type: string
          format: date-time
          description: Last modification timestamp
        SVClient:
          type: integer
          description: Client version
        __v:
          type: integer
          description: Document version
      required:
        - asset
        - serial_number
        - status
    CreateAssetUnitRequest:
      type: object
      properties:
        asset:
          type: string
          description: Asset ID reference
          example: 507f1f77bcf86cd799439012
        serial_number:
          type: string
          description: Unique serial number for this unit
          example: AST-001-2024
        barcode:
          type: string
          description: Barcode identifier
        status:
          type: string
          description: Initial status of the asset unit
          enum:
            - active
            - maintenance
            - retired
            - disposed
          default: active
        condition:
          type: string
          description: Physical condition of the asset
          enum:
            - excellent
            - good
            - fair
            - poor
          default: good
        location:
          type: string
          description: Current location of the asset unit
        assigned_to:
          type: string
          description: User or department assigned to this asset
        purchase_date:
          type: string
          format: date
          description: Date when the asset unit was purchased
        warranty_expiry:
          type: string
          format: date
          description: Warranty expiration date
        purchase_cost:
          type: number
          format: float
          description: Original purchase cost
        depreciation:
          type: object
          properties:
            method:
              type: string
              enum:
                - straight-line
                - declining-balance
                - sum-of-years
            rate:
              type: number
              format: float
        notes:
          type: string
          description: Additional notes about the asset unit
        custom_fields:
          type: object
          description: Custom fields for additional data
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the asset unit is disabled
          default: false
      required:
        - asset
        - serial_number
    UpdateAssetUnitRequest:
      type: object
      properties:
        serial_number:
          type: string
          description: Unique serial number for this unit
        barcode:
          type: string
          description: Barcode identifier
        status:
          type: string
          description: Status of the asset unit
          enum:
            - active
            - maintenance
            - retired
            - disposed
        condition:
          type: string
          description: Physical condition of the asset
          enum:
            - excellent
            - good
            - fair
            - poor
        location:
          type: string
          description: Current location of the asset unit
        assigned_to:
          type: string
          description: User or department assigned to this asset
        purchase_date:
          type: string
          format: date
          description: Date when the asset unit was purchased
        warranty_expiry:
          type: string
          format: date
          description: Warranty expiration date
        last_maintenance:
          type: string
          format: date-time
          description: Date of last maintenance
        next_maintenance:
          type: string
          format: date
          description: Date of next scheduled maintenance
        purchase_cost:
          type: number
          format: float
          description: Original purchase cost
        depreciation:
          type: object
          properties:
            method:
              type: string
              enum:
                - straight-line
                - declining-balance
                - sum-of-years
            rate:
              type: number
              format: float
            current_value:
              type: number
              format: float
        notes:
          type: string
          description: Additional notes about the asset unit
        custom_fields:
          type: object
          description: Custom fields for additional data
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the asset unit is disabled
    AssetFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Asset"
        meta:
          type: object
    AssetCreateBody:
      type: object
      properties:
        name:
          type: string
        serialNumber:
          type: string
        assetType:
          type: string
        client:
          type: string
        location:
          type: object
        status:
          type: string
        purchaseDate:
          type: string
          format: date-time
        warrantyExpiry:
          type: string
          format: date-time
        customFields:
          type: object
    AssetCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Asset"
    AssetGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Asset"
    AssetUpdateBody:
      type: object
      properties:
        name:
          type: string
        serialNumber:
          type: string
        assetType:
          type: string
        client:
          type: string
        location:
          type: object
        status:
          type: string
        purchaseDate:
          type: string
          format: date-time
        warrantyExpiry:
          type: string
          format: date-time
        customFields:
          type: object
    AssetUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Asset"
    AssetRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    Asset:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        serialNumber:
          type: string
        assetType:
          type: string
        client:
          type: string
        location:
          type: object
        status:
          type: string
        purchaseDate:
          type: string
          format: date-time
        warrantyExpiry:
          type: string
          format: date-time
        customFields:
          type: object
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    BankFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Bank"
        meta:
          type: object
    BankCreateBody:
      type: object
      properties:
        name:
          type: string
        code:
          type: string
        country:
          type: string
        disabled:
          type: boolean
    BankCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Bank"
    BankGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Bank"
    BankUpdateBody:
      type: object
      properties:
        name:
          type: string
        code:
          type: string
        country:
          type: string
        disabled:
          type: boolean
    BankUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Bank"
    BankRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    Bank:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        code:
          type: string
        country:
          type: string
        disabled:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    BankListFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/BankList"
        meta:
          type: object
    BankListCreateBody:
      type: object
      properties:
        name:
          type: string
        banks:
          type: array
          items:
            type: string
        disabled:
          type: boolean
    BankListCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/BankList"
    BankListGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/BankList"
    BankListUpdateBody:
      type: object
      properties:
        name:
          type: string
        banks:
          type: array
          items:
            type: string
        disabled:
          type: boolean
    BankListUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/BankList"
    BankListRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    BankList:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        banks:
          type: array
          items:
            type: string
        disabled:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    BrandFindResult:
      type: object
      description: Result of finding brands
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/BrandSchema"
        total_result:
          type: number
          description: Total number of brands
        current_count:
          type: number
          description: Count of brands in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of brands per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    BrandSchema:
      type: object
      description: Brand schema
      properties:
        _id:
          type: string
          description: Unique identifier for the brand
        name:
          type: string
          description: Name of the brand
        local_name:
          type: string
          description: Localized name of the brand
        disabled:
          type: boolean
          description: Whether the brand is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    BrandCreateBody:
      type: object
      description: Body for creating a brand
      required:
        - name
      properties:
        name:
          type: string
          description: Name of the brand
        local_name:
          type: string
          description: Localized name of the brand
        disabled:
          type: boolean
          description: Whether the brand is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
    BrandCreateResult:
      $ref: "#/components/schemas/BrandSchema"
      description: Result of creating a brand
    BrandGetResult:
      $ref: "#/components/schemas/BrandSchema"
      description: Result of getting a brand
    BrandUpdateBody:
      type: object
      description: Body for updating a brand
      properties:
        name:
          type: string
          description: Name of the brand
        local_name:
          type: string
          description: Localized name of the brand
        disabled:
          type: boolean
          description: Whether the brand is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        _id:
          type: string
          description: Unique identifier for the brand
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    BrandUpdateResult:
      $ref: "#/components/schemas/BrandSchema"
      description: Result of updating a brand
    BrandRemoveResult:
      $ref: "#/components/schemas/BrandSchema"
      description: Result of removing a brand
    CategoryFindResult:
      type: object
      description: Result of finding categories
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/CategorySchema"
        total_result:
          type: number
          description: Total number of categories
        current_count:
          type: number
          description: Count of categories in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of categories per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    CategorySchema:
      type: object
      description: Category schema
      properties:
        _id:
          type: string
          description: Unique identifier for the category
        type:
          type: string
          enum:
            - main
          description: Category type
        name:
          type: string
          description: Name of the category
        photo:
          type: string
          description: Photo URL of the category
        local_name:
          type: string
          description: Localized name of the category
        icon:
          type: string
          description: Icon for the category
        disabled:
          type: boolean
          description: Whether the category is disabled
        position:
          type: number
          description: Position of the category
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    CategoryCreateBody:
      type: object
      description: Body for creating a category
      required:
        - name
      properties:
        name:
          type: string
          description: Name of the category
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        type:
          type: string
          enum:
            - main
          description: Category type
        disabled:
          type: boolean
          description: Whether the category is disabled
        photo:
          type: string
          description: Photo URL of the category
        local_name:
          type: string
          description: Localized name of the category
        icon:
          type: string
          description: Icon for the category
        position:
          type: number
          description: Position of the category
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    CategoryCreateResult:
      $ref: "#/components/schemas/CategorySchema"
      description: Result of creating a category
    CategoryGetResult:
      $ref: "#/components/schemas/CategorySchema"
      description: Result of getting a category
    CategoryUpdateBody:
      type: object
      description: Body for updating a category
      properties:
        name:
          type: string
          description: Name of the category
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        type:
          type: string
          enum:
            - main
          description: Category type
        disabled:
          type: boolean
          description: Whether the category is disabled
        photo:
          type: string
          description: Photo URL of the category
        local_name:
          type: string
          description: Localized name of the category
        icon:
          type: string
          description: Icon for the category
        position:
          type: number
          description: Position of the category
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        _id:
          type: string
          description: Unique identifier for the category
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    CategoryUpdateResult:
      $ref: "#/components/schemas/CategorySchema"
      description: Result of updating a category
    CategoryRemoveResult:
      $ref: "#/components/schemas/CategorySchema"
      description: Result of removing a category
    CheckFindResult:
      type: object
      description: Result of finding checks
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/CheckSchema"
        total_result:
          type: number
          description: Total number of checks
        current_count:
          type: number
          description: Count of checks in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of checks per page
    CheckSchema:
      type: object
      description: Check schema
      properties:
        _id:
          type: string
          description: Unique identifier for the check
        client:
          type: string
          description: Client ID associated with the check
        rep:
          type: string
          description: Representative ID who received the check
        checkNumber:
          type: string
          description: Check number
        amount:
          type: number
          description: Check amount
        bank:
          type: string
          description: Bank name or ID
        accountNumber:
          type: string
          description: Account number
        issueDate:
          type: string
          format: date-time
          description: Date when check was issued
        dueDate:
          type: string
          format: date-time
          description: Due date of the check
        status:
          type: string
          enum:
            - pending
            - cleared
            - bounced
            - cancelled
          description: Status of the check
        clearedDate:
          type: string
          format: date-time
          description: Date when check was cleared
        notes:
          type: string
          description: Additional notes
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    CheckCreateBody:
      type: object
      description: Body for creating a check
      required:
        - client
        - checkNumber
        - amount
        - bank
        - dueDate
      properties:
        client:
          type: string
          description: Client ID associated with the check
        rep:
          type: string
          description: Representative ID who received the check
        checkNumber:
          type: string
          description: Check number
        amount:
          type: number
          description: Check amount
        bank:
          type: string
          description: Bank name or ID
        accountNumber:
          type: string
          description: Account number
        issueDate:
          type: string
          format: date-time
          description: Date when check was issued
        dueDate:
          type: string
          format: date-time
          description: Due date of the check
        notes:
          type: string
          description: Additional notes
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    CheckCreateResult:
      $ref: "#/components/schemas/CheckSchema"
      description: Result of creating a check
    CheckGetResult:
      $ref: "#/components/schemas/CheckSchema"
      description: Result of getting a check
    ChannelSchema:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the channel
          example: 60f1b2b3c9e9a12345678901
        name:
          type: string
          description: Channel name
          example: Retail Channel
        local_name:
          type: string
          description: Local/translated name
          example: قناة التجزئة
        disabled:
          type: boolean
          description: Whether the channel is disabled
          example: false
        integration_meta:
          type: object
          additionalProperties: true
          description: Metadata for third-party integrations
          example:
            external_id: ch_123
            sync_status: active
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces this channel belongs to
          example:
            - company1
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
          example: "2023-01-15T10:30:00.000Z"
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
          example: "2023-01-15T10:30:00.000Z"
        __v:
          type: integer
          description: Version key
          example: 0
      required:
        - _id
        - name
        - company_namespace
        - createdAt
        - updatedAt
        - __v
    ChannelCreateBody:
      type: object
      properties:
        name:
          type: string
          description: Channel name (required)
          example: Retail Channel
        local_name:
          type: string
          description: Local/translated name
          example: قناة التجزئة
        disabled:
          type: boolean
          description: Whether the channel is disabled
          example: false
        integration_meta:
          type: object
          additionalProperties: true
          description: Metadata for third-party integrations
          example:
            external_id: ch_123
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces this channel belongs to
          example:
            - company1
      required:
        - name
    ChannelUpdateBody:
      type: object
      properties:
        name:
          type: string
          description: Channel name
          example: Updated Retail Channel
        local_name:
          type: string
          description: Local/translated name
          example: قناة التجزئة المحدثة
        disabled:
          type: boolean
          description: Whether the channel is disabled
          example: false
        integration_meta:
          type: object
          additionalProperties: true
          description: Metadata for third-party integrations
          example:
            external_id: ch_123
            sync_status: updated
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces this channel belongs to
          example:
            - company1
        _id:
          type: string
          description: Channel ID (for internal use)
          example: 60f1b2b3c9e9a12345678901
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp (for internal use)
          example: "2023-01-15T10:30:00.000Z"
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp (for internal use)
          example: "2023-01-15T10:30:00.000Z"
        __v:
          type: integer
          description: Version key (for internal use)
          example: 0
    PaginationResult:
      type: object
      properties:
        page:
          type: integer
          example: 1
        per_page:
          type: integer
          example: 25
        pre_page:
          type: integer
          example: 0
        next_page:
          type: integer
          example: 2
        total:
          type: integer
          example: 100
        total_page:
          type: integer
          example: 4
    ClientContactSchema:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the client contact
          example: 60f1b2b3c9e9a12345678901
        creator:
          oneOf:
            - $ref: "#/components/schemas/AdminCreator"
            - $ref: "#/components/schemas/RepCreator"
            - $ref: "#/components/schemas/ClientCreator"
          description: User who created this contact
        editor:
          oneOf:
            - $ref: "#/components/schemas/AdminCreator"
            - $ref: "#/components/schemas/RepCreator"
            - $ref: "#/components/schemas/ClientCreator"
          description: User who last edited this contact
        name:
          type: string
          description: Contact name
          example: John Smith
        local_name:
          type: string
          description: Local/translated name
          example: جون سميث
        phone1:
          type: string
          description: Primary phone number
          example: "+1234567890"
        phone2:
          type: string
          description: Secondary phone number
          example: "+1234567891"
        email:
          type: string
          format: email
          description: Email address
          example: john.smith@example.com
        title:
          type: string
          description: Job title or position
          example: Sales Manager
        extra_info:
          type: string
          description: Additional information about the contact
          example: Primary contact for technical issues
        disabled:
          type: boolean
          description: Whether the contact is disabled
          example: false
        media:
          type: array
          items:
            type: string
          description: Array of media file URLs
          example:
            - https://example.com/photo1.jpg
        cover_photo:
          type: string
          description: Cover photo URL
          example: https://example.com/cover.jpg
        integration_meta:
          type: object
          additionalProperties: true
          description: Metadata for third-party integrations
          example:
            external_id: contact_123
            sync_status: active
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces this contact belongs to
          example:
            - company1
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
          example: "2023-01-15T10:30:00.000Z"
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
          example: "2023-01-15T10:30:00.000Z"
        __v:
          type: integer
          description: Version key
          example: 0
      required:
        - _id
        - creator
        - name
        - company_namespace
        - createdAt
        - updatedAt
        - __v
    ClientContactCreateBody:
      type: object
      properties:
        name:
          type: string
          description: Contact name (required)
          example: John Smith
        creator:
          oneOf:
            - $ref: "#/components/schemas/AdminCreator"
            - $ref: "#/components/schemas/RepCreator"
            - $ref: "#/components/schemas/ClientCreator"
          description: User who created this contact
        editor:
          oneOf:
            - $ref: "#/components/schemas/AdminCreator"
            - $ref: "#/components/schemas/RepCreator"
            - $ref: "#/components/schemas/ClientCreator"
          description: User who last edited this contact
        local_name:
          type: string
          description: Local/translated name
          example: جون سميث
        phone1:
          type: string
          description: Primary phone number
          example: "+1234567890"
        phone2:
          type: string
          description: Secondary phone number
          example: "+1234567891"
        email:
          type: string
          format: email
          description: Email address
          example: john.smith@example.com
        title:
          type: string
          description: Job title or position
          example: Sales Manager
        extra_info:
          type: string
          description: Additional information about the contact
          example: Primary contact for technical issues
        disabled:
          type: boolean
          description: Whether the contact is disabled
          example: false
        media:
          type: array
          items:
            type: string
          description: Array of media file URLs
          example:
            - https://example.com/photo1.jpg
        cover_photo:
          type: string
          description: Cover photo URL
          example: https://example.com/cover.jpg
        integration_meta:
          type: object
          additionalProperties: true
          description: Metadata for third-party integrations
          example:
            external_id: contact_123
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces this contact belongs to
          example:
            - company1
      required:
        - name
    ClientContactUpdateBody:
      type: object
      properties:
        name:
          type: string
          description: Contact name
          example: John Smith Updated
        creator:
          oneOf:
            - $ref: "#/components/schemas/AdminCreator"
            - $ref: "#/components/schemas/RepCreator"
            - $ref: "#/components/schemas/ClientCreator"
          description: User who created this contact
        editor:
          oneOf:
            - $ref: "#/components/schemas/AdminCreator"
            - $ref: "#/components/schemas/RepCreator"
            - $ref: "#/components/schemas/ClientCreator"
          description: User who last edited this contact
        local_name:
          type: string
          description: Local/translated name
          example: جون سميث محدث
        phone1:
          type: string
          description: Primary phone number
          example: "+1234567890"
        phone2:
          type: string
          description: Secondary phone number
          example: "+1234567891"
        email:
          type: string
          format: email
          description: Email address
          example: john.smith.updated@example.com
        title:
          type: string
          description: Job title or position
          example: Senior Sales Manager
        extra_info:
          type: string
          description: Additional information about the contact
          example: Primary contact for technical issues - updated
        disabled:
          type: boolean
          description: Whether the contact is disabled
          example: false
        media:
          type: array
          items:
            type: string
          description: Array of media file URLs
          example:
            - https://example.com/photo1.jpg
            - https://example.com/photo2.jpg
        cover_photo:
          type: string
          description: Cover photo URL
          example: https://example.com/cover-updated.jpg
        integration_meta:
          type: object
          additionalProperties: true
          description: Metadata for third-party integrations
          example:
            external_id: contact_123
            sync_status: updated
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces this contact belongs to
          example:
            - company1
        _id:
          type: string
          description: Contact ID (for internal use)
          example: 60f1b2b3c9e9a12345678901
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp (for internal use)
          example: "2023-01-15T10:30:00.000Z"
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp (for internal use)
          example: "2023-01-15T10:30:00.000Z"
        __v:
          type: integer
          description: Version key (for internal use)
          example: 0
    AdminCreator:
      type: object
      properties:
        _id:
          type: string
          example: 60f1b2b3c9e9a12345678901
        username:
          type: string
          example: admin_user
        name:
          type: string
          example: Admin User
        type:
          type: string
          enum:
            - admin
          example: admin
      required:
        - _id
        - username
        - name
        - type
    RepCreator:
      type: object
      properties:
        _id:
          type: string
          example: 60f1b2b3c9e9a12345678902
        username:
          type: string
          example: rep_user
        name:
          type: string
          example: Rep User
        type:
          type: string
          enum:
            - rep
          example: rep
      required:
        - _id
        - username
        - name
        - type
    ClientCreator:
      type: object
      properties:
        _id:
          type: string
          example: 60f1b2b3c9e9a12345678903
        username:
          type: string
          example: client_user
        name:
          type: string
          example: Client User
        type:
          type: string
          enum:
            - client
          example: client
      required:
        - _id
        - username
        - name
        - type
    ClientLocation:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier
          example: 507f1f77bcf86cd799439011
        client:
          type: string
          description: Client ID
          example: 507f1f77bcf86cd799439012
        name:
          type: string
          description: Location name
          example: Main Office
        address:
          type: string
          description: Street address
          example: 123 Main St
        city:
          type: string
          description: City name
          example: New York
        state:
          type: string
          description: State or province
          example: NY
        postal_code:
          type: string
          description: Postal or ZIP code
          example: "10001"
        country:
          type: string
          description: Country name
          example: United States
        coordinates:
          type: object
          properties:
            latitude:
              type: number
              format: float
              description: Latitude coordinate
              example: 40.7128
            longitude:
              type: number
              format: float
              description: Longitude coordinate
              example: -74.006
        is_primary:
          type: boolean
          description: Whether this is the primary location
          example: true
        location_type:
          type: string
          description: Type of location
          enum:
            - office
            - warehouse
            - retail
            - branch
            - other
          example: office
        contact_info:
          type: object
          properties:
            phone:
              type: string
              description: Phone number
              example: +1-555-123-4567
            email:
              type: string
              format: email
              description: Email address
              example: contact@example.com
            fax:
              type: string
              description: Fax number
        business_hours:
          type: object
          properties:
            monday:
              $ref: "#/components/schemas/BusinessHours"
            tuesday:
              $ref: "#/components/schemas/BusinessHours"
            wednesday:
              $ref: "#/components/schemas/BusinessHours"
            thursday:
              $ref: "#/components/schemas/BusinessHours"
            friday:
              $ref: "#/components/schemas/BusinessHours"
            saturday:
              $ref: "#/components/schemas/BusinessHours"
            sunday:
              $ref: "#/components/schemas/BusinessHours"
        notes:
          type: string
          description: Additional notes about the location
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the location is disabled
          example: false
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        modifiedAt:
          type: string
          format: date-time
          description: Last modification timestamp
        SVClient:
          type: integer
          description: Client version
        __v:
          type: integer
          description: Document version
      required:
        - client
        - name
        - address
    BusinessHours:
      type: object
      properties:
        open:
          type: string
          format: time
          description: Opening time (HH:MM format)
          example: "09:00"
        close:
          type: string
          format: time
          description: Closing time (HH:MM format)
          example: "17:00"
        is_closed:
          type: boolean
          description: Whether the location is closed on this day
          default: false
    CreateClientLocationRequest:
      type: object
      properties:
        client:
          type: string
          description: Client ID
          example: 507f1f77bcf86cd799439012
        name:
          type: string
          description: Location name
          example: Main Office
        address:
          type: string
          description: Street address
          example: 123 Main St
        city:
          type: string
          description: City name
          example: New York
        state:
          type: string
          description: State or province
          example: NY
        postal_code:
          type: string
          description: Postal or ZIP code
          example: "10001"
        country:
          type: string
          description: Country name
          example: United States
        coordinates:
          type: object
          properties:
            latitude:
              type: number
              format: float
            longitude:
              type: number
              format: float
        is_primary:
          type: boolean
          description: Whether this is the primary location
          default: false
        location_type:
          type: string
          description: Type of location
          enum:
            - office
            - warehouse
            - retail
            - branch
            - other
          default: office
        contact_info:
          type: object
          properties:
            phone:
              type: string
            email:
              type: string
              format: email
            fax:
              type: string
        business_hours:
          type: object
          properties:
            monday:
              $ref: "#/components/schemas/BusinessHours"
            tuesday:
              $ref: "#/components/schemas/BusinessHours"
            wednesday:
              $ref: "#/components/schemas/BusinessHours"
            thursday:
              $ref: "#/components/schemas/BusinessHours"
            friday:
              $ref: "#/components/schemas/BusinessHours"
            saturday:
              $ref: "#/components/schemas/BusinessHours"
            sunday:
              $ref: "#/components/schemas/BusinessHours"
        notes:
          type: string
          description: Additional notes about the location
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the location is disabled
          default: false
      required:
        - client
        - name
        - address
    UpdateClientLocationRequest:
      type: object
      properties:
        name:
          type: string
          description: Location name
        address:
          type: string
          description: Street address
        city:
          type: string
          description: City name
        state:
          type: string
          description: State or province
        postal_code:
          type: string
          description: Postal or ZIP code
        country:
          type: string
          description: Country name
        coordinates:
          type: object
          properties:
            latitude:
              type: number
              format: float
            longitude:
              type: number
              format: float
        is_primary:
          type: boolean
          description: Whether this is the primary location
        location_type:
          type: string
          description: Type of location
          enum:
            - office
            - warehouse
            - retail
            - branch
            - other
        contact_info:
          type: object
          properties:
            phone:
              type: string
            email:
              type: string
              format: email
            fax:
              type: string
        business_hours:
          type: object
          properties:
            monday:
              $ref: "#/components/schemas/BusinessHours"
            tuesday:
              $ref: "#/components/schemas/BusinessHours"
            wednesday:
              $ref: "#/components/schemas/BusinessHours"
            thursday:
              $ref: "#/components/schemas/BusinessHours"
            friday:
              $ref: "#/components/schemas/BusinessHours"
            saturday:
              $ref: "#/components/schemas/BusinessHours"
            sunday:
              $ref: "#/components/schemas/BusinessHours"
        notes:
          type: string
          description: Additional notes about the location
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the location is disabled
    ClientFindResult:
      type: object
      description: Result of finding clients
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/ClientSchema"
        total_result:
          type: number
          description: Total number of clients
        current_count:
          type: number
          description: Count of clients in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of clients per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    ClientSchema:
      type: object
      description: Client schema
      properties:
        _id:
          type: string
          description: Unique identifier for the client
        name:
          type: string
          description: Name of the client
        local_name:
          type: string
          description: Localized name of the client
        tags:
          type: array
          items:
            type: string
          description: Tags associated with the client
        cell_phone:
          type: string
          description: Cell phone number
        city:
          type: string
          description: City
        client_code:
          type: string
          description: Client code
        contact_name:
          type: string
          description: Contact name
        contact_title:
          type: string
          description: Contact title
        contacts:
          type: array
          items:
            type: string
          description: Associated contacts
        country:
          type: string
          description: Country
        disabled:
          type: boolean
          description: Whether the client is disabled
        formatted_address:
          type: string
          description: Formatted address
        lat:
          type: number
          description: Latitude coordinate
        lng:
          type: number
          description: Longitude coordinate
        location_verified:
          type: boolean
          description: Whether the location is verified
        phone:
          type: string
          description: Phone number
        state:
          type: string
          description: State
        zip:
          type: string
          description: Zip/Postal code
        assigned_to:
          type: array
          items:
            type: string
          description: Representatives assigned to this client
        last_location_update:
          type: number
          description: Timestamp of last location update
        credit_limit:
          type: number
          description: Credit limit
        tax_number:
          type: string
          description: Tax number
        sync_id:
          type: string
          description: Sync identifier
        profile_pic:
          type: string
          description: Profile picture URL
        logo:
          type: string
          description: Logo URL
        website:
          type: string
          description: Website URL
        email:
          type: string
          description: Email address
        comment:
          type: string
          description: Comments
        parent_client_id:
          type: string
          description: Parent client ID for hierarchical relationships
        target_visit:
          type: number
          description: Target number of visits
        geofencing_radius:
          type: number
          description: Geofencing radius
        price_tag:
          type: string
          description: Price tag
        status:
          type: string
          description: Status
        job_category:
          type: array
          items:
            type: string
          description: Job categories
        territory:
          type: string
          description: Territory
        sv_priceList:
          type: string
          description: Price list ID
        customFields:
          type: object
          additionalProperties: true
          description: Custom fields
        paymentTerm:
          type: string
          description: Payment term ID
        speciality:
          type: array
          items:
            type: string
          description: Specialities
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        channel:
          type: string
          description: Channel ID
        isChain:
          type: boolean
          description: Whether this is a chain
        chain:
          type: string
          description: Chain ID
        teams:
          type: array
          items:
            type: string
          description: Teams
        payment_type:
          type: string
          enum:
            - cash
            - credit
          description: Payment type
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        integrated_client_balance:
          type: number
          description: Integrated client balance
        invoice_balance_limit:
          type: number
          description: Invoice balance limit
        enable_invoice_balance_limit:
          type: boolean
          description: Whether invoice balance limit is enabled
        enable_payment_terms_grace_period_days:
          type: boolean
          description: Whether payment terms grace period days is enabled
        is_simplified:
          type: boolean
          description: Whether this is a simplified client
        last_login_time:
          type: number
          description: Last login timestamp
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    ClientCreateBody:
      type: object
      description: Body for creating a client
      required:
        - name
      properties:
        name:
          type: string
          description: Name of the client
        local_name:
          type: string
          description: Localized name of the client
        tags:
          type: array
          items:
            type: string
          description: Tags associated with the client
        cell_phone:
          type: string
          description: Cell phone number
        city:
          type: string
          description: City
        client_code:
          type: string
          description: Client code
        contact_name:
          type: string
          description: Contact name
        contact_title:
          type: string
          description: Contact title
        contacts:
          type: array
          items:
            type: string
          description: Associated contacts
        country:
          type: string
          description: Country
        disabled:
          type: boolean
          description: Whether the client is disabled
        formatted_address:
          type: string
          description: Formatted address
        lat:
          type: number
          description: Latitude coordinate
        lng:
          type: number
          description: Longitude coordinate
        location_verified:
          type: boolean
          description: Whether the location is verified
        phone:
          type: string
          description: Phone number
        state:
          type: string
          description: State
        zip:
          type: string
          description: Zip/Postal code
        assigned_to:
          type: array
          items:
            type: string
          description: Representatives assigned to this client
        credit_limit:
          type: number
          description: Credit limit
        tax_number:
          type: string
          description: Tax number
        sync_id:
          type: string
          description: Sync identifier
        profile_pic:
          type: string
          description: Profile picture URL
        logo:
          type: string
          description: Logo URL
        website:
          type: string
          description: Website URL
        email:
          type: string
          description: Email address
        comment:
          type: string
          description: Comments
        parent_client_id:
          type: string
          description: Parent client ID for hierarchical relationships
        target_visit:
          type: number
          description: Target number of visits
        geofencing_radius:
          type: number
          description: Geofencing radius
        price_tag:
          type: string
          description: Price tag
        status:
          type: string
          description: Status
        job_category:
          type: array
          items:
            type: string
          description: Job categories
        territory:
          type: string
          description: Territory
        sv_priceList:
          type: string
          description: Price list ID
        customFields:
          type: object
          additionalProperties: true
          description: Custom fields
        paymentTerm:
          type: string
          description: Payment term ID
        speciality:
          type: array
          items:
            type: string
          description: Specialities
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        channel:
          type: string
          description: Channel ID
        isChain:
          type: boolean
          description: Whether this is a chain
        chain:
          type: string
          description: Chain ID
        teams:
          type: array
          items:
            type: string
          description: Teams
        payment_type:
          type: string
          enum:
            - cash
            - credit
          description: Payment type
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    ClientCreateResult:
      $ref: "#/components/schemas/ClientSchema"
      description: Result of creating a client
    ClientGetResult:
      $ref: "#/components/schemas/ClientSchema"
      description: Result of getting a client
    ClientUpdateBody:
      type: object
      description: Body for updating a client
      properties:
        name:
          type: string
          description: Name of the client
        local_name:
          type: string
          description: Localized name of the client
        tags:
          type: array
          items:
            type: string
          description: Tags associated with the client
        cell_phone:
          type: string
          description: Cell phone number
        city:
          type: string
          description: City
        client_code:
          type: string
          description: Client code
        contact_name:
          type: string
          description: Contact name
        contact_title:
          type: string
          description: Contact title
        contacts:
          type: array
          items:
            type: string
          description: Associated contacts
        country:
          type: string
          description: Country
        disabled:
          type: boolean
          description: Whether the client is disabled
        formatted_address:
          type: string
          description: Formatted address
        lat:
          type: number
          description: Latitude coordinate
        lng:
          type: number
          description: Longitude coordinate
        location_verified:
          type: boolean
          description: Whether the location is verified
        phone:
          type: string
          description: Phone number
        state:
          type: string
          description: State
        zip:
          type: string
          description: Zip/Postal code
        assigned_to:
          type: array
          items:
            type: string
          description: Representatives assigned to this client
        credit_limit:
          type: number
          description: Credit limit
        tax_number:
          type: string
          description: Tax number
        sync_id:
          type: string
          description: Sync identifier
        profile_pic:
          type: string
          description: Profile picture URL
        logo:
          type: string
          description: Logo URL
        website:
          type: string
          description: Website URL
        email:
          type: string
          description: Email address
        comment:
          type: string
          description: Comments
        parent_client_id:
          type: string
          description: Parent client ID for hierarchical relationships
        target_visit:
          type: number
          description: Target number of visits
        geofencing_radius:
          type: number
          description: Geofencing radius
        price_tag:
          type: string
          description: Price tag
        status:
          type: string
          description: Status
        job_category:
          type: array
          items:
            type: string
          description: Job categories
        territory:
          type: string
          description: Territory
        sv_priceList:
          type: string
          description: Price list ID
        customFields:
          type: object
          additionalProperties: true
          description: Custom fields
        paymentTerm:
          type: string
          description: Payment term ID
        speciality:
          type: array
          items:
            type: string
          description: Specialities
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        channel:
          type: string
          description: Channel ID
        isChain:
          type: boolean
          description: Whether this is a chain
        chain:
          type: string
          description: Chain ID
        teams:
          type: array
          items:
            type: string
          description: Teams
        payment_type:
          type: string
          enum:
            - cash
            - credit
          description: Payment type
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        _id:
          type: string
          description: Unique identifier for the client
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    ClientUpdateResult:
      $ref: "#/components/schemas/ClientSchema"
      description: Result of updating a client
    ClientRemoveResult:
      $ref: "#/components/schemas/ClientSchema"
      description: Result of removing a client
    ContractInstallment:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier
          example: 507f1f77bcf86cd799439011
        contract:
          type: string
          description: Contract ID reference
          example: 507f1f77bcf86cd799439012
        installment_number:
          type: integer
          description: Installment sequence number
          example: 1
        due_date:
          type: string
          format: date
          description: Due date for this installment
          example: "2024-01-15"
        amount:
          type: number
          format: float
          description: Installment amount
          example: 1500
        currency:
          type: string
          description: Currency code
          example: USD
        status:
          type: string
          description: Payment status
          enum:
            - pending
            - paid
            - overdue
            - cancelled
          example: pending
        payment_date:
          type: string
          format: date
          description: Date when payment was made (if paid)
        payment_amount:
          type: number
          format: float
          description: Amount actually paid
        payment_method:
          type: string
          description: Payment method used
          enum:
            - cash
            - check
            - credit_card
            - bank_transfer
            - other
        payment_reference:
          type: string
          description: Payment reference number
        late_fee:
          type: number
          format: float
          description: Late fee charged if overdue
          example: 50
        discount_applied:
          type: number
          format: float
          description: Discount applied to this installment
        interest_rate:
          type: number
          format: float
          description: Interest rate for this installment
          example: 5.5
        grace_period_days:
          type: integer
          description: Grace period in days before marking overdue
          example: 5
        reminder_sent:
          type: boolean
          description: Whether payment reminder has been sent
          example: false
        reminder_dates:
          type: array
          items:
            type: string
            format: date-time
          description: Dates when reminders were sent
        auto_pay_enabled:
          type: boolean
          description: Whether auto-pay is enabled for this installment
          example: false
        payment_history:
          type: array
          items:
            type: object
            properties:
              date:
                type: string
                format: date-time
              amount:
                type: number
                format: float
              method:
                type: string
              reference:
                type: string
              notes:
                type: string
          description: History of payment attempts
        notes:
          type: string
          description: Additional notes
        custom_fields:
          type: object
          description: Custom fields for additional data
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        modifiedAt:
          type: string
          format: date-time
          description: Last modification timestamp
        SVClient:
          type: integer
          description: Client version
        __v:
          type: integer
          description: Document version
      required:
        - contract
        - installment_number
        - due_date
        - amount
        - status
    CreateContractInstallmentRequest:
      type: object
      properties:
        contract:
          type: string
          description: Contract ID reference
          example: 507f1f77bcf86cd799439012
        installment_number:
          type: integer
          description: Installment sequence number
          example: 1
        due_date:
          type: string
          format: date
          description: Due date for this installment
          example: "2024-01-15"
        amount:
          type: number
          format: float
          description: Installment amount
          example: 1500
        currency:
          type: string
          description: Currency code
          default: USD
        late_fee:
          type: number
          format: float
          description: Late fee charged if overdue
          default: 0
        discount_applied:
          type: number
          format: float
          description: Discount applied to this installment
          default: 0
        interest_rate:
          type: number
          format: float
          description: Interest rate for this installment
          default: 0
        grace_period_days:
          type: integer
          description: Grace period in days before marking overdue
          default: 0
        auto_pay_enabled:
          type: boolean
          description: Whether auto-pay is enabled for this installment
          default: false
        notes:
          type: string
          description: Additional notes
        custom_fields:
          type: object
          description: Custom fields for additional data
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
      required:
        - contract
        - installment_number
        - due_date
        - amount
    UpdateContractInstallmentRequest:
      type: object
      properties:
        due_date:
          type: string
          format: date
          description: Due date for this installment
        amount:
          type: number
          format: float
          description: Installment amount
        status:
          type: string
          description: Payment status
          enum:
            - pending
            - paid
            - overdue
            - cancelled
        payment_date:
          type: string
          format: date
          description: Date when payment was made
        payment_amount:
          type: number
          format: float
          description: Amount actually paid
        payment_method:
          type: string
          description: Payment method used
          enum:
            - cash
            - check
            - credit_card
            - bank_transfer
            - other
        payment_reference:
          type: string
          description: Payment reference number
        late_fee:
          type: number
          format: float
          description: Late fee charged if overdue
        discount_applied:
          type: number
          format: float
          description: Discount applied to this installment
        interest_rate:
          type: number
          format: float
          description: Interest rate for this installment
        grace_period_days:
          type: integer
          description: Grace period in days before marking overdue
        auto_pay_enabled:
          type: boolean
          description: Whether auto-pay is enabled for this installment
        notes:
          type: string
          description: Additional notes
        custom_fields:
          type: object
          description: Custom fields for additional data
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
    ContractFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Contract"
        meta:
          type: object
    ContractCreateBody:
      type: object
      properties:
        title:
          type: string
        client:
          type: string
        startDate:
          type: string
          format: date-time
        endDate:
          type: string
          format: date-time
        totalAmount:
          type: number
        currency:
          type: string
        status:
          type: string
        terms:
          type: string
        installments:
          type: array
          items:
            type: object
    ContractCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Contract"
    ContractGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Contract"
    ContractUpdateBody:
      type: object
      properties:
        title:
          type: string
        client:
          type: string
        startDate:
          type: string
          format: date-time
        endDate:
          type: string
          format: date-time
        totalAmount:
          type: number
        currency:
          type: string
        status:
          type: string
        terms:
          type: string
        installments:
          type: array
          items:
            type: object
    ContractUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Contract"
    ContractRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    Contract:
      type: object
      properties:
        _id:
          type: string
        title:
          type: string
        client:
          type: string
        startDate:
          type: string
          format: date-time
        endDate:
          type: string
          format: date-time
        totalAmount:
          type: number
        currency:
          type: string
        status:
          type: string
        terms:
          type: string
        installments:
          type: array
          items:
            type: object
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    CustomListItemFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/CustomListItem"
        meta:
          type: object
    CustomListItemCreateBody:
      type: object
      properties:
        name:
          type: string
        value:
          type: string
        customList:
          type: string
        disabled:
          type: boolean
    CustomListItemCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/CustomListItem"
    CustomListItemGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/CustomListItem"
    CustomListItemUpdateBody:
      type: object
      properties:
        name:
          type: string
        value:
          type: string
        customList:
          type: string
        disabled:
          type: boolean
    CustomListItemUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/CustomListItem"
    CustomListItemRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    CustomListItem:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        value:
          type: string
        customList:
          type: string
        disabled:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    CustomListFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/CustomList"
        meta:
          type: object
    CustomListCreateBody:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        entity:
          type: string
        disabled:
          type: boolean
    CustomListCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/CustomList"
    CustomListGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/CustomList"
    CustomListUpdateBody:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        entity:
          type: string
        disabled:
          type: boolean
    CustomListUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/CustomList"
    CustomListRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    CustomList:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        description:
          type: string
        entity:
          type: string
        disabled:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    CustomStatusFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/CustomStatus"
        meta:
          type: object
    CustomStatusCreateBody:
      type: object
      properties:
        name:
          type: string
        color:
          type: string
        entity:
          type: string
        disabled:
          type: boolean
    CustomStatusCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/CustomStatus"
    CustomStatusGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/CustomStatus"
    CustomStatusUpdateBody:
      type: object
      properties:
        name:
          type: string
        color:
          type: string
        entity:
          type: string
        disabled:
          type: boolean
    CustomStatusUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/CustomStatus"
    CustomStatusRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    CustomStatus:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        color:
          type: string
        entity:
          type: string
        disabled:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    DayFindResult:
      type: object
      description: Result of finding days
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/DaySchema"
        total_result:
          type: number
          description: Total number of days
        current_count:
          type: number
          description: Count of days in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of days per page
    DaySchema:
      type: object
      description: Day schema
      properties:
        _id:
          type: string
          description: Unique identifier for the day
        rep:
          type: string
          description: Representative ID
        date:
          type: string
          format: date
          description: Date of the working day
        startTime:
          type: string
          format: time
          description: Start time of the day
        endTime:
          type: string
          format: time
          description: End time of the day
        status:
          type: string
          enum:
            - open
            - closed
            - submitted
          description: Status of the day
        visits:
          type: array
          items:
            type: string
          description: List of visit IDs for the day
        orders:
          type: array
          items:
            type: string
          description: List of order IDs for the day
        activities:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                description: Activity type
              description:
                type: string
                description: Activity description
              timestamp:
                type: string
                format: date-time
                description: Activity timestamp
          description: List of activities for the day
        summary:
          type: object
          properties:
            totalVisits:
              type: number
              description: Total number of visits
            totalOrders:
              type: number
              description: Total number of orders
            totalSales:
              type: number
              description: Total sales amount
          description: Day summary statistics
        notes:
          type: string
          description: Additional notes for the day
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    DayCreateBody:
      type: object
      description: Body for creating a day
      required:
        - rep
        - date
      properties:
        rep:
          type: string
          description: Representative ID
        date:
          type: string
          format: date
          description: Date of the working day
        startTime:
          type: string
          format: time
          description: Start time of the day
        notes:
          type: string
          description: Additional notes for the day
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    DayCreateResult:
      $ref: "#/components/schemas/DaySchema"
      description: Result of creating a day
    DayGetResult:
      $ref: "#/components/schemas/DaySchema"
      description: Result of getting a day
    FeedbackOptions:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier
          example: 507f1f77bcf86cd799439011
        name:
          type: string
          description: Template name
          example: Sales Visit Feedback
        description:
          type: string
          description: Template description
          example: Feedback template for sales visit activities
        category:
          type: string
          description: Category of the template
          example: sales
        template_type:
          type: string
          description: Type of feedback template
          enum:
            - survey
            - rating
            - nps
            - custom
          example: survey
        questions:
          type: array
          items:
            $ref: "#/components/schemas/FeedbackQuestion"
          description: List of questions in the template
        settings:
          type: object
          properties:
            allow_anonymous:
              type: boolean
              description: Allow anonymous feedback
              default: true
            require_all_questions:
              type: boolean
              description: Require all questions to be answered
              default: false
            show_progress:
              type: boolean
              description: Show progress indicator
              default: true
            randomize_questions:
              type: boolean
              description: Randomize question order
              default: false
            max_completion_time:
              type: integer
              description: Maximum time to complete in minutes
            reminder_settings:
              type: object
              properties:
                send_reminders:
                  type: boolean
                reminder_intervals:
                  type: array
                  items:
                    type: integer
                  description: Reminder intervals in hours
        styling:
          type: object
          properties:
            theme:
              type: string
              enum:
                - light
                - dark
                - custom
              default: light
            primary_color:
              type: string
              description: Primary color hex code
              example: "#007bff"
            font_family:
              type: string
              description: Font family
              example: Arial, sans-serif
            custom_css:
              type: string
              description: Custom CSS styles
        notification_settings:
          type: object
          properties:
            notify_on_completion:
              type: boolean
              description: Send notification when feedback is completed
            notify_on_low_rating:
              type: boolean
              description: Send notification for low ratings
            low_rating_threshold:
              type: integer
              description: Threshold for low rating notifications
              minimum: 1
              maximum: 10
            notification_recipients:
              type: array
              items:
                type: string
              description: Email addresses to notify
        is_active:
          type: boolean
          description: Whether the template is active
          example: true
        usage_count:
          type: integer
          description: Number of times template has been used
          example: 25
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        modifiedAt:
          type: string
          format: date-time
          description: Last modification timestamp
        SVClient:
          type: integer
          description: Client version
        __v:
          type: integer
          description: Document version
      required:
        - name
        - template_type
        - questions
    FeedbackQuestion:
      type: object
      properties:
        question_id:
          type: string
          description: Unique question identifier
        question_text:
          type: string
          description: The question text
          example: How satisfied were you with the service?
        question_type:
          type: string
          description: Type of question
          enum:
            - rating
            - multiple_choice
            - text
            - yes_no
            - scale
            - nps
          example: rating
        is_required:
          type: boolean
          description: Whether the question is required
          default: false
        options:
          type: array
          items:
            type: object
            properties:
              value:
                type: string
              label:
                type: string
              weight:
                type: number
                format: float
          description: Options for multiple choice questions
        validation:
          type: object
          properties:
            min_length:
              type: integer
            max_length:
              type: integer
            pattern:
              type: string
            custom_validation:
              type: string
        display_settings:
          type: object
          properties:
            show_labels:
              type: boolean
            orientation:
              type: string
              enum:
                - horizontal
                - vertical
            scale_min:
              type: integer
            scale_max:
              type: integer
            scale_step:
              type: integer
        conditional_logic:
          type: object
          properties:
            show_if:
              type: object
              properties:
                question_id:
                  type: string
                operator:
                  type: string
                  enum:
                    - equals
                    - not_equals
                    - greater_than
                    - less_than
                value:
                  oneOf:
                    - type: string
                    - type: integer
                    - type: boolean
      required:
        - question_text
        - question_type
    CreateFeedbackOptionsRequest:
      type: object
      properties:
        name:
          type: string
          description: Template name
          example: Sales Visit Feedback
        description:
          type: string
          description: Template description
        category:
          type: string
          description: Category of the template
        template_type:
          type: string
          description: Type of feedback template
          enum:
            - survey
            - rating
            - nps
            - custom
        questions:
          type: array
          items:
            $ref: "#/components/schemas/FeedbackQuestion"
        settings:
          type: object
          properties:
            allow_anonymous:
              type: boolean
              default: true
            require_all_questions:
              type: boolean
              default: false
            show_progress:
              type: boolean
              default: true
            randomize_questions:
              type: boolean
              default: false
            max_completion_time:
              type: integer
        styling:
          type: object
          properties:
            theme:
              type: string
              enum:
                - light
                - dark
                - custom
              default: light
            primary_color:
              type: string
            font_family:
              type: string
            custom_css:
              type: string
        notification_settings:
          type: object
          properties:
            notify_on_completion:
              type: boolean
              default: false
            notify_on_low_rating:
              type: boolean
              default: false
            low_rating_threshold:
              type: integer
            notification_recipients:
              type: array
              items:
                type: string
        is_active:
          type: boolean
          description: Whether the template is active
          default: true
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
      required:
        - name
        - template_type
        - questions
    UpdateFeedbackOptionsRequest:
      type: object
      properties:
        name:
          type: string
          description: Template name
        description:
          type: string
          description: Template description
        category:
          type: string
          description: Category of the template
        questions:
          type: array
          items:
            $ref: "#/components/schemas/FeedbackQuestion"
        settings:
          type: object
          properties:
            allow_anonymous:
              type: boolean
            require_all_questions:
              type: boolean
            show_progress:
              type: boolean
            randomize_questions:
              type: boolean
            max_completion_time:
              type: integer
        styling:
          type: object
          properties:
            theme:
              type: string
              enum:
                - light
                - dark
                - custom
            primary_color:
              type: string
            font_family:
              type: string
            custom_css:
              type: string
        notification_settings:
          type: object
          properties:
            notify_on_completion:
              type: boolean
            notify_on_low_rating:
              type: boolean
            low_rating_threshold:
              type: integer
            notification_recipients:
              type: array
              items:
                type: string
        is_active:
          type: boolean
          description: Whether the template is active
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
    FullInvoiceFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/FullInvoice"
        meta:
          type: object
    FullInvoiceCreateBody:
      type: object
      properties:
        serial:
          type: string
        client:
          type: string
        rep:
          type: string
        warehouse:
          type: string
        items:
          type: array
          items:
            type: object
        total:
          type: number
        status:
          type: string
        dueDate:
          type: string
          format: date-time
    FullInvoiceCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/FullInvoice"
    FullInvoiceGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/FullInvoice"
    FullInvoiceUpdateBody:
      type: object
      properties:
        serial:
          type: string
        client:
          type: string
        rep:
          type: string
        warehouse:
          type: string
        items:
          type: array
          items:
            type: object
        total:
          type: number
        status:
          type: string
        dueDate:
          type: string
          format: date-time
    FullInvoiceUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/FullInvoice"
    FullInvoice:
      type: object
      properties:
        _id:
          type: string
        serial:
          type: string
        client:
          type: string
        rep:
          type: string
        warehouse:
          type: string
        items:
          type: array
          items:
            type: object
        total:
          type: number
        status:
          type: string
        dueDate:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    IntegrationActionLog:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the integration action log record
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        integrationId:
          type: string
          description: Integration identifier
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        actionType:
          type: string
          enum:
            - create
            - update
            - delete
            - sync
            - webhook
          description: Type of action performed
          example: create
        entityType:
          type: string
          description: Type of entity affected
          example: product
        entityId:
          type: string
          description: ID of the affected entity
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        status:
          type: string
          enum:
            - pending
            - success
            - failed
            - retrying
          description: Status of the action
          example: success
        payload:
          type: object
          additionalProperties: true
          description: Action payload data
        response:
          type: object
          additionalProperties: true
          description: Response data from the action
        errorMessage:
          type: string
          description: Error message if action failed
        retryCount:
          type: integer
          minimum: 0
          default: 0
          description: Number of retry attempts
        executionTime:
          type: number
          description: Execution time in milliseconds
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - integrationId
        - actionType
        - entityType
        - status
    IntegrationActionLogInput:
      type: object
      properties:
        integrationId:
          type: string
          description: Integration identifier
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        actionType:
          type: string
          enum:
            - create
            - update
            - delete
            - sync
            - webhook
          description: Type of action performed
          example: create
        entityType:
          type: string
          description: Type of entity affected
          example: product
        entityId:
          type: string
          description: ID of the affected entity
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        status:
          type: string
          enum:
            - pending
            - success
            - failed
            - retrying
          description: Status of the action
          example: success
        payload:
          type: object
          additionalProperties: true
          description: Action payload data
        response:
          type: object
          additionalProperties: true
          description: Response data from the action
        errorMessage:
          type: string
          description: Error message if action failed
        retryCount:
          type: integer
          minimum: 0
          default: 0
          description: Number of retry attempts
        executionTime:
          type: number
          description: Execution time in milliseconds
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - integrationId
        - actionType
        - entityType
        - status
    IntegrationAppFindResult:
      type: object
      description: Result of finding integration apps
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/IntegrationAppSchema"
        total_result:
          type: number
          description: Total number of integration apps
        current_count:
          type: number
          description: Count of integration apps in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of integration apps per page
    IntegrationAppSchema:
      type: object
      description: Integration app schema
      properties:
        _id:
          type: string
          description: Unique identifier for the integration app
        name:
          type: string
          description: Name of the integration app
        description:
          type: string
          description: Description of the integration app
        category:
          type: string
          description: Category of the integration
        version:
          type: string
          description: Version of the integration app
        status:
          type: string
          enum:
            - active
            - inactive
            - pending
          description: Status of the integration app
        available_app:
          type: string
          description: Available app reference
        company_namespace:
          type: string
          description: Company namespace
        config:
          type: object
          additionalProperties: true
          description: Configuration settings for the integration
        credentials:
          type: object
          additionalProperties: true
          description: Credentials for the integration
        endpoints:
          type: object
          additionalProperties: true
          description: API endpoints configuration
        webhooks:
          type: object
          additionalProperties: true
          description: Webhook configuration
        sync_settings:
          type: object
          additionalProperties: true
          description: Synchronization settings
        last_sync:
          type: string
          format: date-time
          description: Last synchronization timestamp
        error_count:
          type: number
          description: Number of errors encountered
        success_count:
          type: number
          description: Number of successful operations
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    IntegrationAppCreateBody:
      type: object
      description: Body for creating an integration app
      required:
        - name
        - available_app
        - company_namespace
      properties:
        name:
          type: string
          description: Name of the integration app
        description:
          type: string
          description: Description of the integration app
        available_app:
          type: string
          description: Available app reference
        company_namespace:
          type: string
          description: Company namespace
        config:
          type: object
          additionalProperties: true
          description: Configuration settings for the integration
        credentials:
          type: object
          additionalProperties: true
          description: Credentials for the integration
        endpoints:
          type: object
          additionalProperties: true
          description: API endpoints configuration
        webhooks:
          type: object
          additionalProperties: true
          description: Webhook configuration
        sync_settings:
          type: object
          additionalProperties: true
          description: Synchronization settings
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    IntegrationAppCreateResult:
      $ref: "#/components/schemas/IntegrationAppSchema"
      description: Result of creating an integration app
    IntegrationAppGetResult:
      $ref: "#/components/schemas/IntegrationAppSchema"
      description: Result of getting an integration app
    IntegrationAppUpdateBody:
      type: object
      description: Body for updating an integration app
      properties:
        name:
          type: string
          description: Name of the integration app
        description:
          type: string
          description: Description of the integration app
        status:
          type: string
          enum:
            - active
            - inactive
            - pending
          description: Status of the integration app
        config:
          type: object
          additionalProperties: true
          description: Configuration settings for the integration
        credentials:
          type: object
          additionalProperties: true
          description: Credentials for the integration
        endpoints:
          type: object
          additionalProperties: true
          description: API endpoints configuration
        webhooks:
          type: object
          additionalProperties: true
          description: Webhook configuration
        sync_settings:
          type: object
          additionalProperties: true
          description: Synchronization settings
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    IntegrationAppUpdateResult:
      $ref: "#/components/schemas/IntegrationAppSchema"
      description: Result of updating an integration app
    IntegrationCommandLog:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the integration command log record
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        integrationId:
          type: string
          description: Integration identifier
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        commandType:
          type: string
          enum:
            - sync
            - import
            - export
            - validate
            - transform
          description: Type of command executed
          example: sync
        command:
          type: string
          description: The actual command that was executed
          example: sync-products
        parameters:
          type: object
          additionalProperties: true
          description: Command parameters
        status:
          type: string
          enum:
            - pending
            - running
            - completed
            - failed
            - cancelled
          description: Status of the command execution
          example: completed
        startTime:
          type: string
          format: date-time
          description: Command start time
          example: "2023-01-15T08:00:00Z"
        endTime:
          type: string
          format: date-time
          description: Command end time
          example: "2023-01-15T08:05:00Z"
        duration:
          type: number
          description: Command execution duration in milliseconds
          example: 300000
        output:
          type: object
          additionalProperties: true
          description: Command output data
        errorLog:
          type: string
          description: Error log if command failed
        processedRecords:
          type: integer
          minimum: 0
          description: Number of records processed
        failedRecords:
          type: integer
          minimum: 0
          description: Number of records that failed processing
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - integrationId
        - commandType
        - command
        - status
    IntegrationCommandLogInput:
      type: object
      properties:
        integrationId:
          type: string
          description: Integration identifier
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        commandType:
          type: string
          enum:
            - sync
            - import
            - export
            - validate
            - transform
          description: Type of command executed
          example: sync
        command:
          type: string
          description: The actual command that was executed
          example: sync-products
        parameters:
          type: object
          additionalProperties: true
          description: Command parameters
        status:
          type: string
          enum:
            - pending
            - running
            - completed
            - failed
            - cancelled
          description: Status of the command execution
          example: completed
        startTime:
          type: string
          format: date-time
          description: Command start time
          example: "2023-01-15T08:00:00Z"
        endTime:
          type: string
          format: date-time
          description: Command end time
          example: "2023-01-15T08:05:00Z"
        duration:
          type: number
          description: Command execution duration in milliseconds
          example: 300000
        output:
          type: object
          additionalProperties: true
          description: Command output data
        errorLog:
          type: string
          description: Error log if command failed
        processedRecords:
          type: integer
          minimum: 0
          description: Number of records processed
        failedRecords:
          type: integer
          minimum: 0
          description: Number of records that failed processing
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - integrationId
        - commandType
        - command
        - status
    InventoryAdjustmentReasonFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/InventoryAdjustmentReason"
        meta:
          type: object
    InventoryAdjustmentReasonCreateBody:
      type: object
      properties:
        name:
          type: string
        type:
          type: string
          enum:
            - increase
            - decrease
        disabled:
          type: boolean
    InventoryAdjustmentReasonCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/InventoryAdjustmentReason"
    InventoryAdjustmentReasonGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/InventoryAdjustmentReason"
    InventoryAdjustmentReasonUpdateBody:
      type: object
      properties:
        name:
          type: string
        type:
          type: string
          enum:
            - increase
            - decrease
        disabled:
          type: boolean
    InventoryAdjustmentReasonUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/InventoryAdjustmentReason"
    InventoryAdjustmentReasonRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    InventoryAdjustmentReason:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        type:
          type: string
          enum:
            - increase
            - decrease
        disabled:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    InventoryFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Inventory"
        meta:
          type: object
    Inventory:
      type: object
      properties:
        _id:
          type: string
        product:
          type: string
        variant:
          type: string
        warehouse:
          type: string
        quantity:
          type: number
        reservedQuantity:
          type: number
        availableQuantity:
          type: number
        cost:
          type: number
        lastUpdated:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    MailUnsubscribe:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier
          example: 507f1f77bcf86cd799439011
        email:
          type: string
          format: email
          description: Unsubscribed email address
          example: user@example.com
        reason:
          type: string
          description: Reason for unsubscribing
          example: User requested unsubscribe
        unsubscribe_types:
          type: array
          items:
            type: string
          description: Types of emails to unsubscribe from
          example:
            - marketing
            - newsletters
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        user_agent:
          type: string
          description: User agent of the request
        ip_address:
          type: string
          description: IP address of the request
        createdAt:
          type: string
          format: date-time
          description: Unsubscribe date
        modifiedAt:
          type: string
          format: date-time
          description: Last modification timestamp
        SVClient:
          type: integer
          description: Client version
        __v:
          type: integer
          description: Document version
      required:
        - email
    CreateMailUnsubscribeRequest:
      type: object
      properties:
        email:
          type: string
          format: email
          description: Email address to unsubscribe
          example: user@example.com
        reason:
          type: string
          description: Reason for unsubscribing
          example: User requested unsubscribe
        unsubscribe_types:
          type: array
          items:
            type: string
          description: Types of emails to unsubscribe from
          default:
            - all
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        user_agent:
          type: string
          description: User agent of the request
        ip_address:
          type: string
          description: IP address of the request
      required:
        - email
    MeasureUnitFamilyFindResult:
      type: object
      description: Result of finding measure unit families
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/MeasureUnitFamilySchemaWithPopulatedKeys"
        total_result:
          type: number
          description: Total number of measure unit families
        current_count:
          type: number
          description: Count of measure unit families in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of measure unit families per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    MeasureUnitFamilySchema:
      type: object
      description: Measure unit family schema
      properties:
        _id:
          type: string
          description: Unique identifier for the measure unit family
        name:
          type: string
          description: Name of the measure unit family
        local_name:
          type: string
          description: Localized name of the measure unit family
        measureunits:
          type: array
          items:
            type: string
          description: Measure unit IDs in this family
        disabled:
          type: boolean
          description: Whether the measure unit family is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    MeasureUnitFamilySchemaWithPopulatedKeys:
      allOf:
        - $ref: "#/components/schemas/MeasureUnitFamilySchema"
        - type: object
          properties:
            measureunits_populated:
              oneOf:
                - type: array
                  items:
                    type: string
                - type: array
                  items:
                    type: object
                    properties:
                      _id:
                        type: string
                      name:
                        type: string
                      factor:
                        type: number
                      local_name:
                        type: string
                      parent:
                        type: string
                      disabled:
                        type: boolean
                      integration_meta:
                        type: object
                        additionalProperties: true
                      company_namespace:
                        type: array
                        items:
                          type: string
                      createdAt:
                        type: string
                        format: date-time
                      updatedAt:
                        type: string
                        format: date-time
                      __v:
                        type: number
              description: Populated measure units
    MeasureUnitFamilyCreateBody:
      type: object
      description: Body for creating a measure unit family
      required:
        - name
      properties:
        name:
          type: string
          description: Name of the measure unit family
        local_name:
          type: string
          description: Localized name of the measure unit family
        measureunits:
          type: array
          items:
            type: string
          description: IDs of measure units in this family
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        disabled:
          type: boolean
          description: Whether the measure unit family is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    MeasureUnitFamilyCreateResult:
      $ref: "#/components/schemas/MeasureUnitFamilySchema"
      description: Result of creating a measure unit family
    MeasureUnitFamilyGetResult:
      $ref: "#/components/schemas/MeasureUnitFamilySchema"
      description: Result of getting a measure unit family
    MeasureUnitFamilyUpdateBody:
      type: object
      description: Body for updating a measure unit family
      properties:
        name:
          type: string
          description: Name of the measure unit family
        local_name:
          type: string
          description: Localized name of the measure unit family
        measureunits:
          type: array
          items:
            type: string
          description: IDs of measure units in this family
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        disabled:
          type: boolean
          description: Whether the measure unit family is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        _id:
          type: string
          description: Unique identifier for the measure unit family
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    MeasureUnitFamilyUpdateResult:
      $ref: "#/components/schemas/MeasureUnitFamilySchema"
      description: Result of updating a measure unit family
    MeasureUnitFamilyRemoveResult:
      $ref: "#/components/schemas/MeasureUnitFamilySchema"
      description: Result of removing a measure unit family
    MeasureUnitFindResult:
      type: object
      description: Result of finding measure units
      properties:
        data:
          type: array
          items:
            oneOf:
              - $ref: "#/components/schemas/MeasureUnitSchema"
              - allOf:
                  - $ref: "#/components/schemas/MeasureUnitSchema"
                  - type: object
                    properties:
                      family:
                        type: array
                        items:
                          $ref: "#/components/schemas/MeasureUnitFamilySchema"
        total_result:
          type: number
          description: Total number of measure units
        current_count:
          type: number
          description: Count of measure units in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of measure units per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    MeasureUnitSchema:
      type: object
      description: Measure unit schema
      properties:
        _id:
          type: string
          description: Unique identifier for the measure unit
        name:
          type: string
          description: Name of the measure unit
        factor:
          type: number
          description: Factor of the measure unit
        local_name:
          type: string
          description: Localized name of the measure unit
        parent:
          type: string
          description: Parent measure unit ID
        disabled:
          type: boolean
          description: Whether the measure unit is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    MeasureUnitCreateBody:
      type: object
      description: Body for creating a measure unit
      required:
        - name
        - factor
      properties:
        name:
          type: string
          description: Name of the measure unit
        factor:
          type: number
          description: Factor of the measure unit
        local_name:
          type: string
          description: Localized name of the measure unit
        parent:
          type: string
          description: Parent measure unit ID
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        disabled:
          type: boolean
          description: Whether the measure unit is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    MeasureUnitCreateResult:
      $ref: "#/components/schemas/MeasureUnitSchema"
      description: Result of creating a measure unit
    MeasureUnitGetResult:
      $ref: "#/components/schemas/MeasureUnitSchema"
      description: Result of getting a measure unit
    MeasureUnitUpdateBody:
      type: object
      description: Body for updating a measure unit
      properties:
        name:
          type: string
          description: Name of the measure unit
        factor:
          type: number
          description: Factor of the measure unit
        local_name:
          type: string
          description: Localized name of the measure unit
        parent:
          type: string
          description: Parent measure unit ID
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        disabled:
          type: boolean
          description: Whether the measure unit is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        _id:
          type: string
          description: Unique identifier for the measure unit
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    MeasureUnitUpdateResult:
      $ref: "#/components/schemas/MeasureUnitSchema"
      description: Result of updating a measure unit
    MeasureUnitRemoveResult:
      $ref: "#/components/schemas/MeasureUnitSchema"
      description: Result of removing a measure unit
    MediaStorageFindResult:
      type: object
      description: Result of finding media storage items
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/MediaStorageSchema"
        total_result:
          type: number
          description: Total number of media storage items
        current_count:
          type: number
          description: Count of media storage items in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of media storage items per page
    MediaStorageSchema:
      type: object
      description: Media storage schema
      properties:
        _id:
          type: string
          description: Unique identifier for the media storage item
        filename:
          type: string
          description: Original filename
        url:
          type: string
          description: URL to access the media file
        mimeType:
          type: string
          description: MIME type of the file
        size:
          type: number
          description: File size in bytes
        category:
          type: string
          description: Media category
        entityType:
          type: string
          description: Type of entity this media is associated with
        entityId:
          type: string
          description: ID of the entity this media is associated with
        uploadedBy:
          type: string
          description: ID of user who uploaded the media
        isPublic:
          type: boolean
          description: Whether the media is publicly accessible
        thumbnailUrl:
          type: string
          description: URL to thumbnail version (for images)
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata about the file
        tags:
          type: array
          items:
            type: string
          description: Tags associated with the media
        description:
          type: string
          description: Description of the media
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    MediaStorageCreateBody:
      type: object
      description: Body for creating a media storage item
      required:
        - filename
        - url
        - mimeType
        - size
      properties:
        filename:
          type: string
          description: Original filename
        url:
          type: string
          description: URL to access the media file
        mimeType:
          type: string
          description: MIME type of the file
        size:
          type: number
          description: File size in bytes
        category:
          type: string
          description: Media category
        entityType:
          type: string
          description: Type of entity this media is associated with
        entityId:
          type: string
          description: ID of the entity this media is associated with
        isPublic:
          type: boolean
          description: Whether the media is publicly accessible
        thumbnailUrl:
          type: string
          description: URL to thumbnail version (for images)
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata about the file
        tags:
          type: array
          items:
            type: string
          description: Tags associated with the media
        description:
          type: string
          description: Description of the media
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    MediaStorageCreateResult:
      $ref: "#/components/schemas/MediaStorageSchema"
      description: Result of creating a media storage item
    MediaStorageGetResult:
      $ref: "#/components/schemas/MediaStorageSchema"
      description: Result of getting a media storage item
    MediaStorageUpdateBody:
      type: object
      description: Body for updating a media storage item
      properties:
        filename:
          type: string
          description: Original filename
        category:
          type: string
          description: Media category
        entityType:
          type: string
          description: Type of entity this media is associated with
        entityId:
          type: string
          description: ID of the entity this media is associated with
        isPublic:
          type: boolean
          description: Whether the media is publicly accessible
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata about the file
        tags:
          type: array
          items:
            type: string
          description: Tags associated with the media
        description:
          type: string
          description: Description of the media
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    MediaStorageUpdateResult:
      $ref: "#/components/schemas/MediaStorageSchema"
      description: Result of updating a media storage item
    MediaStorageRemoveResult:
      $ref: "#/components/schemas/MediaStorageSchema"
      description: Result of removing a media storage item
    MediaFindResult:
      type: object
      description: Result of finding media
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/MediaSchema"
        total_result:
          type: number
          description: Total number of media
        current_count:
          type: number
          description: Count of media in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of media per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    MediaSchema:
      type: object
      description: Media schema
      properties:
        _id:
          type: string
          description: Unique identifier for the media
        name:
          type: string
          description: Name of the media
        description:
          type: string
          description: Description of the media
        url:
          type: string
          description: URL of the media
        document_type:
          type: string
          enum:
            - html
            - csv
            - json
            - image
            - pdf
            - ppt
            - pptx
            - xls
            - xlsx
            - doc
            - docx
            - images
            - zip
            - pt
          description: Type of media document
        parent_document_type:
          type: string
          enum:
            - clients
            - asset
            - assetUnit
            - workorder
            - clientLocation
            - clientContact
            - commentsThread
            - workorderRequest
            - workorderPortal
            - invoice
            - products
            - productvariations
            - representatives
            - productcategories
            - productSubCategory
            - speciality
            - line
            - banner
            - intgAvailableApps
          description: Type of parent document
        parent_document_key:
          type: string
          description: Key of parent document
        disabled:
          type: boolean
          description: Whether the media is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    MediaCreateBody:
      type: object
      description: Body for creating media
      required:
        - name
        - url
        - document_type
      properties:
        name:
          type: string
          description: Name of the media
        description:
          type: string
          description: Description of the media
        url:
          type: string
          description: URL of the media
        document_type:
          type: string
          enum:
            - html
            - csv
            - json
            - image
            - pdf
            - ppt
            - pptx
            - xls
            - xlsx
            - doc
            - docx
            - images
            - zip
            - pt
          description: Type of media document
        parent_document_type:
          type: string
          enum:
            - clients
            - asset
            - assetUnit
            - workorder
            - clientLocation
            - clientContact
            - commentsThread
            - workorderRequest
            - workorderPortal
            - invoice
            - products
            - productvariations
            - representatives
            - productcategories
            - productSubCategory
            - speciality
            - line
            - banner
            - intgAvailableApps
          description: Type of parent document
        parent_document_key:
          type: string
          description: Key of parent document
        disabled:
          type: boolean
          description: Whether the media is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
    MediaCreateResult:
      $ref: "#/components/schemas/MediaSchema"
      description: Result of creating media
    MediaGetResult:
      $ref: "#/components/schemas/MediaSchema"
      description: Result of getting media
    MediaUpdateBody:
      type: object
      description: Body for updating media
      properties:
        name:
          type: string
          description: Name of the media
        description:
          type: string
          description: Description of the media
        url:
          type: string
          description: URL of the media
        document_type:
          type: string
          enum:
            - html
            - csv
            - json
            - image
            - pdf
            - ppt
            - pptx
            - xls
            - xlsx
            - doc
            - docx
            - images
            - zip
            - pt
          description: Type of media document
        parent_document_type:
          type: string
          enum:
            - clients
            - asset
            - assetUnit
            - workorder
            - clientLocation
            - clientContact
            - commentsThread
            - workorderRequest
            - workorderPortal
            - invoice
            - products
            - productvariations
            - representatives
            - productcategories
            - productSubCategory
            - speciality
            - line
            - banner
            - intgAvailableApps
          description: Type of parent document
        parent_document_key:
          type: string
          description: Key of parent document
        disabled:
          type: boolean
          description: Whether the media is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        _id:
          type: string
          description: Unique identifier for the media
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    MediaUpdateResult:
      $ref: "#/components/schemas/MediaSchema"
      description: Result of updating media
    MediaRemoveResult:
      $ref: "#/components/schemas/MediaSchema"
      description: Result of removing media
    MSLProductFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/MSLProduct"
        meta:
          type: object
    MSLProductCreateBody:
      type: object
      properties:
        msl:
          type: string
        product:
          type: string
        variant:
          type: string
        targetQuantity:
          type: number
        achievedQuantity:
          type: number
        disabled:
          type: boolean
    MSLProductCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/MSLProduct"
    MSLProductGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/MSLProduct"
    MSLProductUpdateBody:
      type: object
      properties:
        msl:
          type: string
        product:
          type: string
        variant:
          type: string
        targetQuantity:
          type: number
        achievedQuantity:
          type: number
        disabled:
          type: boolean
    MSLProductUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/MSLProduct"
    MSLProductRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    MSLProduct:
      type: object
      properties:
        _id:
          type: string
        msl:
          type: string
        product:
          type: string
        variant:
          type: string
        targetQuantity:
          type: number
        achievedQuantity:
          type: number
        disabled:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    MSLFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/MSL"
        meta:
          type: object
    MSLCreateBody:
      type: object
      properties:
        name:
          type: string
        client:
          type: string
        rep:
          type: string
        startDate:
          type: string
          format: date-time
        endDate:
          type: string
          format: date-time
        disabled:
          type: boolean
    MSLCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/MSL"
    MSLGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/MSL"
    MSLUpdateBody:
      type: object
      properties:
        name:
          type: string
        client:
          type: string
        rep:
          type: string
        startDate:
          type: string
          format: date-time
        endDate:
          type: string
          format: date-time
        disabled:
          type: boolean
    MSLUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/MSL"
    MSLRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    MSL:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        client:
          type: string
        rep:
          type: string
        startDate:
          type: string
          format: date-time
        endDate:
          type: string
          format: date-time
        disabled:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    OcrInvoiceJobGroup:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the OCR invoice job group
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        name:
          type: string
          description: Name of the job group
          example: Monthly Invoice Batch - January 2023
        description:
          type: string
          description: Description of the job group
        batchNumber:
          type: string
          description: Batch number for tracking
          example: BATCH-2023-001
        template:
          type: string
          description: OCR template ID to use for this group
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        totalJobs:
          type: integer
          minimum: 0
          description: Total number of jobs in the group
          example: 150
        completedJobs:
          type: integer
          minimum: 0
          description: Number of completed jobs
          example: 120
        pendingJobs:
          type: integer
          minimum: 0
          description: Number of pending jobs
          example: 20
        failedJobs:
          type: integer
          minimum: 0
          description: Number of failed jobs
          example: 10
        status:
          type: string
          enum:
            - created
            - queued
            - processing
            - completed
            - failed
            - cancelled
          default: created
          description: Overall status of the job group
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
          default: medium
          description: Processing priority
        startedAt:
          type: string
          format: date-time
          description: When processing started
          example: "2023-01-15T08:00:00Z"
        completedAt:
          type: string
          format: date-time
          description: When processing completed
          example: "2023-01-15T10:30:00Z"
        estimatedCompletionTime:
          type: string
          format: date-time
          description: Estimated completion time
          example: "2023-01-15T11:00:00Z"
        processingSettings:
          type: object
          properties:
            parallelJobs:
              type: integer
              minimum: 1
              maximum: 10
              default: 3
              description: Number of parallel jobs to process
            retryCount:
              type: integer
              minimum: 0
              maximum: 5
              default: 2
              description: Number of retry attempts for failed jobs
            timeoutMinutes:
              type: integer
              minimum: 5
              maximum: 120
              default: 30
              description: Timeout for each job in minutes
        statistics:
          type: object
          properties:
            totalDocuments:
              type: integer
              description: Total number of documents processed
            totalPages:
              type: integer
              description: Total number of pages processed
            averageProcessingTime:
              type: number
              format: double
              description: Average processing time per document in seconds
            successRate:
              type: number
              format: double
              minimum: 0
              maximum: 1
              description: Success rate as percentage
            totalCost:
              type: number
              format: double
              minimum: 0
              description: Total processing cost
            currency:
              type: string
              example: USD
        notifications:
          type: object
          properties:
            onCompletion:
              type: boolean
              default: false
              description: Send notification on completion
            onFailure:
              type: boolean
              default: true
              description: Send notification on failure
            recipients:
              type: array
              items:
                type: string
                format: email
              description: Email recipients for notifications
        createdBy:
          type: string
          description: User who created the job group
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        assignedTo:
          type: string
          description: User assigned to manage this group
          example: 60f7b1b3e4b0e8b3f8b3f8b6
        tags:
          type: array
          items:
            type: string
          description: Tags for categorization
          example:
            - monthly
            - invoices
            - accounting
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - name
        - template
    OcrInvoiceJobGroupInput:
      type: object
      properties:
        name:
          type: string
          description: Name of the job group
          example: Monthly Invoice Batch - January 2023
        description:
          type: string
          description: Description of the job group
        batchNumber:
          type: string
          description: Batch number for tracking
          example: BATCH-2023-001
        template:
          type: string
          description: OCR template ID to use for this group
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
          default: medium
          description: Processing priority
        processingSettings:
          type: object
          properties:
            parallelJobs:
              type: integer
              minimum: 1
              maximum: 10
              default: 3
              description: Number of parallel jobs to process
            retryCount:
              type: integer
              minimum: 0
              maximum: 5
              default: 2
              description: Number of retry attempts for failed jobs
            timeoutMinutes:
              type: integer
              minimum: 5
              maximum: 120
              default: 30
              description: Timeout for each job in minutes
        notifications:
          type: object
          properties:
            onCompletion:
              type: boolean
              default: false
              description: Send notification on completion
            onFailure:
              type: boolean
              default: true
              description: Send notification on failure
            recipients:
              type: array
              items:
                type: string
                format: email
              description: Email recipients for notifications
        createdBy:
          type: string
          description: User who created the job group
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        assignedTo:
          type: string
          description: User assigned to manage this group
          example: 60f7b1b3e4b0e8b3f8b3f8b6
        tags:
          type: array
          items:
            type: string
          description: Tags for categorization
          example:
            - monthly
            - invoices
            - accounting
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - name
        - template
    OcrInvoiceJobPage:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the OCR invoice job page
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        job:
          type: string
          description: OCR invoice job ID this page belongs to
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        pageNumber:
          type: integer
          minimum: 1
          description: Page number within the document
          example: 1
        pageUrl:
          type: string
          format: uri
          description: URL of the page image
          example: https://storage.example.com/pages/invoice_2023_001_page_1.png
        status:
          type: string
          enum:
            - pending
            - processing
            - completed
            - failed
            - skipped
          default: pending
          description: Processing status of this page
        pageType:
          type: string
          enum:
            - cover
            - header
            - content
            - footer
            - summary
            - attachment
          description: Type of page content
          example: content
        imageProperties:
          type: object
          properties:
            width:
              type: integer
              description: Image width in pixels
            height:
              type: integer
              description: Image height in pixels
            dpi:
              type: integer
              description: Image resolution in DPI
            colorSpace:
              type: string
              enum:
                - rgb
                - grayscale
                - binary
              description: Color space of the image
            format:
              type: string
              enum:
                - png
                - jpg
                - jpeg
                - tiff
                - bmp
              description: Image format
            size:
              type: integer
              description: File size in bytes
        preprocessing:
          type: object
          properties:
            enhanced:
              type: boolean
              description: Whether image was enhanced
            deskewed:
              type: boolean
              description: Whether image was deskewed
            denoised:
              type: boolean
              description: Whether noise was removed
            binarized:
              type: boolean
              description: Whether image was binarized
            rotationAngle:
              type: number
              format: double
              description: Rotation angle applied
        ocrResults:
          type: object
          properties:
            text:
              type: string
              description: Raw OCR text output
            confidence:
              type: number
              format: double
              minimum: 0
              maximum: 1
              description: Overall OCR confidence for this page
            words:
              type: array
              items:
                type: object
                properties:
                  text:
                    type: string
                    description: Word text
                  confidence:
                    type: number
                    format: double
                    minimum: 0
                    maximum: 1
                    description: Word confidence
                  boundingBox:
                    type: object
                    properties:
                      x:
                        type: number
                        format: double
                      "y":
                        type: number
                        format: double
                      width:
                        type: number
                        format: double
                      height:
                        type: number
                        format: double
            blocks:
              type: array
              items:
                type: object
                properties:
                  text:
                    type: string
                    description: Block text
                  confidence:
                    type: number
                    format: double
                  boundingBox:
                    type: object
                    properties:
                      x:
                        type: number
                        format: double
                      "y":
                        type: number
                        format: double
                      width:
                        type: number
                        format: double
                      height:
                        type: number
                        format: double
                  blockType:
                    type: string
                    enum:
                      - text
                      - table
                      - image
                      - signature
        extractedFields:
          type: object
          additionalProperties: true
          description: Fields extracted from this page
        tableData:
          type: array
          items:
            type: object
            properties:
              rowIndex:
                type: integer
              columnIndex:
                type: integer
              cellText:
                type: string
              confidence:
                type: number
                format: double
              boundingBox:
                type: object
                properties:
                  x:
                    type: number
                  "y":
                    type: number
                  width:
                    type: number
                  height:
                    type: number
        processingTime:
          type: number
          format: double
          description: Processing time for this page in seconds
        startedAt:
          type: string
          format: date-time
          description: When page processing started
          example: "2023-01-15T08:00:00Z"
        completedAt:
          type: string
          format: date-time
          description: When page processing completed
          example: "2023-01-15T08:01:00Z"
        errorLog:
          type: string
          description: Error log if processing failed
        retryCount:
          type: integer
          minimum: 0
          description: Number of retry attempts
        qualityScore:
          type: number
          format: double
          minimum: 0
          maximum: 1
          description: Quality score of the page
        annotations:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - correction
                  - highlight
                  - note
                  - region
              text:
                type: string
              coordinates:
                type: object
                properties:
                  x:
                    type: number
                  "y":
                    type: number
                  width:
                    type: number
                  height:
                    type: number
              createdBy:
                type: string
              createdAt:
                type: string
                format: date-time
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - job
        - pageNumber
        - pageUrl
    OcrInvoiceJobPageInput:
      type: object
      properties:
        job:
          type: string
          description: OCR invoice job ID this page belongs to
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        pageNumber:
          type: integer
          minimum: 1
          description: Page number within the document
          example: 1
        pageUrl:
          type: string
          format: uri
          description: URL of the page image
          example: https://storage.example.com/pages/invoice_2023_001_page_1.png
        pageType:
          type: string
          enum:
            - cover
            - header
            - content
            - footer
            - summary
            - attachment
          description: Type of page content
          example: content
        imageProperties:
          type: object
          properties:
            width:
              type: integer
              description: Image width in pixels
            height:
              type: integer
              description: Image height in pixels
            dpi:
              type: integer
              description: Image resolution in DPI
            colorSpace:
              type: string
              enum:
                - rgb
                - grayscale
                - binary
              description: Color space of the image
            format:
              type: string
              enum:
                - png
                - jpg
                - jpeg
                - tiff
                - bmp
              description: Image format
            size:
              type: integer
              description: File size in bytes
        annotations:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - correction
                  - highlight
                  - note
                  - region
              text:
                type: string
              coordinates:
                type: object
                properties:
                  x:
                    type: number
                  "y":
                    type: number
                  width:
                    type: number
                  height:
                    type: number
              createdBy:
                type: string
              createdAt:
                type: string
                format: date-time
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - job
        - pageNumber
        - pageUrl
    OcrInvoiceJobTemplate:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the OCR invoice job template
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        name:
          type: string
          description: Name of the template
          example: Standard Invoice OCR Template
        description:
          type: string
          description: Description of the template
        version:
          type: string
          description: Template version
          example: 1.0.0
        ocrEngine:
          type: string
          enum:
            - tesseract
            - google-vision
            - aws-textract
            - azure-cognitive
            - custom
          description: OCR engine to use
          example: google-vision
        documentType:
          type: string
          enum:
            - invoice
            - receipt
            - bill
            - statement
            - other
          description: Type of document
          example: invoice
        extractionRules:
          type: object
          properties:
            fields:
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                    description: Field name
                  type:
                    type: string
                    enum:
                      - text
                      - number
                      - date
                      - currency
                      - boolean
                    description: Data type
                  required:
                    type: boolean
                    description: Whether field is required
                  pattern:
                    type: string
                    description: Regex pattern for extraction
                  coordinates:
                    type: object
                    properties:
                      x:
                        type: number
                      "y":
                        type: number
                      width:
                        type: number
                      height:
                        type: number
                  validation:
                    type: object
                    properties:
                      minLength:
                        type: integer
                      maxLength:
                        type: integer
                      format:
                        type: string
            lineItems:
              type: object
              properties:
                enabled:
                  type: boolean
                  description: Whether to extract line items
                tableStructure:
                  type: object
                  properties:
                    headerRow:
                      type: integer
                      description: Header row number
                    dataStartRow:
                      type: integer
                      description: Data start row number
                    columns:
                      type: array
                      items:
                        type: object
                        properties:
                          name:
                            type: string
                          index:
                            type: integer
                          type:
                            type: string
                            enum:
                              - text
                              - number
                              - currency
        preprocessingSettings:
          type: object
          properties:
            imageEnhancement:
              type: boolean
              default: true
              description: Whether to enhance image quality
            deskew:
              type: boolean
              default: true
              description: Whether to correct image skew
            denoising:
              type: boolean
              default: true
              description: Whether to remove noise
            binarization:
              type: boolean
              default: false
              description: Whether to convert to binary image
            resolutionDPI:
              type: integer
              minimum: 150
              maximum: 600
              default: 300
              description: Target resolution in DPI
        postprocessingSettings:
          type: object
          properties:
            spellCheck:
              type: boolean
              default: false
              description: Whether to perform spell checking
            confidenceThreshold:
              type: number
              format: double
              minimum: 0
              maximum: 1
              default: 0.8
              description: Minimum confidence threshold
            validationRules:
              type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                  rule:
                    type: string
                    enum:
                      - required
                      - numeric
                      - date
                      - email
                      - currency
                  message:
                    type: string
        supportedFormats:
          type: array
          items:
            type: string
            enum:
              - pdf
              - png
              - jpg
              - jpeg
              - tiff
              - bmp
          description: Supported document formats
        languages:
          type: array
          items:
            type: string
          description: Supported languages for OCR
          example:
            - en
            - es
            - fr
        accuracy:
          type: object
          properties:
            averageAccuracy:
              type: number
              format: double
              minimum: 0
              maximum: 1
              description: Average accuracy percentage
            fieldAccuracy:
              type: object
              additionalProperties:
                type: number
                format: double
              description: Accuracy per field
        isActive:
          type: boolean
          default: true
          description: Whether the template is active
        isDefault:
          type: boolean
          default: false
          description: Whether this is the default template
        createdBy:
          type: string
          description: User who created the template
        lastModifiedBy:
          type: string
          description: User who last modified the template
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - name
        - ocrEngine
        - documentType
        - extractionRules
    OcrInvoiceJobTemplateInput:
      type: object
      properties:
        name:
          type: string
          description: Name of the template
          example: Standard Invoice OCR Template
        description:
          type: string
          description: Description of the template
        version:
          type: string
          description: Template version
          example: 1.0.0
        ocrEngine:
          type: string
          enum:
            - tesseract
            - google-vision
            - aws-textract
            - azure-cognitive
            - custom
          description: OCR engine to use
          example: google-vision
        documentType:
          type: string
          enum:
            - invoice
            - receipt
            - bill
            - statement
            - other
          description: Type of document
          example: invoice
        extractionRules:
          type: object
          properties:
            fields:
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                    description: Field name
                  type:
                    type: string
                    enum:
                      - text
                      - number
                      - date
                      - currency
                      - boolean
                    description: Data type
                  required:
                    type: boolean
                    description: Whether field is required
                  pattern:
                    type: string
                    description: Regex pattern for extraction
                  coordinates:
                    type: object
                    properties:
                      x:
                        type: number
                      "y":
                        type: number
                      width:
                        type: number
                      height:
                        type: number
                  validation:
                    type: object
                    properties:
                      minLength:
                        type: integer
                      maxLength:
                        type: integer
                      format:
                        type: string
            lineItems:
              type: object
              properties:
                enabled:
                  type: boolean
                  description: Whether to extract line items
                tableStructure:
                  type: object
                  properties:
                    headerRow:
                      type: integer
                      description: Header row number
                    dataStartRow:
                      type: integer
                      description: Data start row number
                    columns:
                      type: array
                      items:
                        type: object
                        properties:
                          name:
                            type: string
                          index:
                            type: integer
                          type:
                            type: string
                            enum:
                              - text
                              - number
                              - currency
        preprocessingSettings:
          type: object
          properties:
            imageEnhancement:
              type: boolean
              default: true
              description: Whether to enhance image quality
            deskew:
              type: boolean
              default: true
              description: Whether to correct image skew
            denoising:
              type: boolean
              default: true
              description: Whether to remove noise
            binarization:
              type: boolean
              default: false
              description: Whether to convert to binary image
            resolutionDPI:
              type: integer
              minimum: 150
              maximum: 600
              default: 300
              description: Target resolution in DPI
        postprocessingSettings:
          type: object
          properties:
            spellCheck:
              type: boolean
              default: false
              description: Whether to perform spell checking
            confidenceThreshold:
              type: number
              format: double
              minimum: 0
              maximum: 1
              default: 0.8
              description: Minimum confidence threshold
            validationRules:
              type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                  rule:
                    type: string
                    enum:
                      - required
                      - numeric
                      - date
                      - email
                      - currency
                  message:
                    type: string
        supportedFormats:
          type: array
          items:
            type: string
            enum:
              - pdf
              - png
              - jpg
              - jpeg
              - tiff
              - bmp
          description: Supported document formats
        languages:
          type: array
          items:
            type: string
          description: Supported languages for OCR
          example:
            - en
            - es
            - fr
        isActive:
          type: boolean
          default: true
          description: Whether the template is active
        isDefault:
          type: boolean
          default: false
          description: Whether this is the default template
        createdBy:
          type: string
          description: User who created the template
        lastModifiedBy:
          type: string
          description: User who last modified the template
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - name
        - ocrEngine
        - documentType
        - extractionRules
    OcrInvoiceJob:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the OCR invoice job
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        jobNumber:
          type: string
          description: Unique job number
          example: OCR-2023-001
        documentName:
          type: string
          description: Name of the document being processed
          example: invoice_2023_001.pdf
        documentUrl:
          type: string
          format: uri
          description: URL of the document to process
          example: https://storage.example.com/invoices/invoice_2023_001.pdf
        documentType:
          type: string
          enum:
            - pdf
            - png
            - jpg
            - jpeg
            - tiff
            - bmp
          description: Type of document
          example: pdf
        template:
          type: string
          description: OCR template ID to use
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        group:
          type: string
          description: OCR job group ID if part of a batch
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        status:
          type: string
          enum:
            - created
            - queued
            - processing
            - completed
            - failed
            - cancelled
          default: created
          description: Processing status
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
          default: medium
          description: Processing priority
        progress:
          type: object
          properties:
            percentage:
              type: number
              format: double
              minimum: 0
              maximum: 100
              description: Processing progress percentage
            currentStep:
              type: string
              description: Current processing step
            totalSteps:
              type: integer
              description: Total number of processing steps
        startedAt:
          type: string
          format: date-time
          description: When processing started
          example: "2023-01-15T08:00:00Z"
        completedAt:
          type: string
          format: date-time
          description: When processing completed
          example: "2023-01-15T08:05:00Z"
        processingTime:
          type: number
          format: double
          description: Processing time in seconds
          example: 45.6
        documentInfo:
          type: object
          properties:
            pages:
              type: integer
              description: Number of pages in document
            size:
              type: integer
              description: File size in bytes
            format:
              type: string
              description: Document format
            resolution:
              type: string
              description: Document resolution
            language:
              type: string
              description: Detected language
        extractedData:
          type: object
          properties:
            invoice:
              type: object
              properties:
                number:
                  type: string
                  description: Invoice number
                date:
                  type: string
                  format: date
                  description: Invoice date
                dueDate:
                  type: string
                  format: date
                  description: Due date
                supplier:
                  type: object
                  properties:
                    name:
                      type: string
                    address:
                      type: string
                    taxId:
                      type: string
                customer:
                  type: object
                  properties:
                    name:
                      type: string
                    address:
                      type: string
                amounts:
                  type: object
                  properties:
                    subtotal:
                      type: number
                      format: double
                    tax:
                      type: number
                      format: double
                    total:
                      type: number
                      format: double
                    currency:
                      type: string
            lineItems:
              type: array
              items:
                type: object
                properties:
                  description:
                    type: string
                  quantity:
                    type: number
                    format: double
                  unitPrice:
                    type: number
                    format: double
                  amount:
                    type: number
                    format: double
        confidence:
          type: object
          properties:
            overall:
              type: number
              format: double
              minimum: 0
              maximum: 1
              description: Overall confidence score
            fields:
              type: object
              additionalProperties:
                type: number
                format: double
              description: Confidence per field
        validationResults:
          type: object
          properties:
            isValid:
              type: boolean
              description: Whether validation passed
            errors:
              type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                  message:
                    type: string
                  severity:
                    type: string
                    enum:
                      - error
                      - warning
                      - info
        cost:
          type: number
          format: double
          minimum: 0
          description: Processing cost
        currency:
          type: string
          description: Currency code
          example: USD
        errorLog:
          type: string
          description: Error log if processing failed
        retryCount:
          type: integer
          minimum: 0
          description: Number of retry attempts
        createdBy:
          type: string
          description: User who created the job
          example: 60f7b1b3e4b0e8b3f8b3f8b6
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - jobNumber
        - documentName
        - documentUrl
        - template
    OcrInvoiceJobInput:
      type: object
      properties:
        jobNumber:
          type: string
          description: Unique job number
          example: OCR-2023-001
        documentName:
          type: string
          description: Name of the document being processed
          example: invoice_2023_001.pdf
        documentUrl:
          type: string
          format: uri
          description: URL of the document to process
          example: https://storage.example.com/invoices/invoice_2023_001.pdf
        documentType:
          type: string
          enum:
            - pdf
            - png
            - jpg
            - jpeg
            - tiff
            - bmp
          description: Type of document
          example: pdf
        template:
          type: string
          description: OCR template ID to use
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        group:
          type: string
          description: OCR job group ID if part of a batch
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
          default: medium
          description: Processing priority
        createdBy:
          type: string
          description: User who created the job
          example: 60f7b1b3e4b0e8b3f8b3f8b6
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - jobNumber
        - documentName
        - documentUrl
        - template
    OcrResults:
      type: object
      properties:
        extractedData:
          type: object
          description: All extracted data from the document
        confidence:
          type: object
          description: Confidence scores for extracted data
        validationResults:
          type: object
          description: Validation results
        processingTime:
          type: number
          format: double
          description: Total processing time
    PatchAction:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the patch action
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        name:
          type: string
          description: Name of the patch action
          example: Update Product Prices
        description:
          type: string
          description: Description of what the patch action does
        targetEntity:
          type: string
          description: The entity type this patch targets
          example: product
        conditions:
          type: object
          additionalProperties: true
          description: Conditions that must be met for the patch to apply
        patches:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
                description: Field to patch
              operation:
                type: string
                enum:
                  - set
                  - unset
                  - add
                  - remove
                  - multiply
                  - divide
                description: Operation to perform
              value:
                description: Value for the operation
        batchSize:
          type: integer
          minimum: 1
          maximum: 1000
          default: 100
          description: Number of records to process in each batch
        status:
          type: string
          enum:
            - draft
            - ready
            - running
            - completed
            - failed
            - cancelled
          default: draft
          description: Status of the patch action
        executionHistory:
          type: array
          items:
            type: object
            properties:
              executionId:
                type: string
              startTime:
                type: string
                format: date-time
              endTime:
                type: string
                format: date-time
              status:
                type: string
                enum:
                  - running
                  - completed
                  - failed
                  - cancelled
              processedCount:
                type: integer
              errorCount:
                type: integer
              errors:
                type: array
                items:
                  type: string
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - name
        - targetEntity
        - patches
    PatchActionInput:
      type: object
      properties:
        name:
          type: string
          description: Name of the patch action
          example: Update Product Prices
        description:
          type: string
          description: Description of what the patch action does
        targetEntity:
          type: string
          description: The entity type this patch targets
          example: product
        conditions:
          type: object
          additionalProperties: true
          description: Conditions that must be met for the patch to apply
        patches:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
                description: Field to patch
              operation:
                type: string
                enum:
                  - set
                  - unset
                  - add
                  - remove
                  - multiply
                  - divide
                description: Operation to perform
              value:
                description: Value for the operation
        batchSize:
          type: integer
          minimum: 1
          maximum: 1000
          default: 100
          description: Number of records to process in each batch
        status:
          type: string
          enum:
            - draft
            - ready
            - running
            - completed
            - failed
            - cancelled
          default: draft
          description: Status of the patch action
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - name
        - targetEntity
        - patches
    PaymentTermFindResult:
      type: object
      properties:
        success:
          type: boolean
        result:
          type: array
          items:
            $ref: "#/components/schemas/PaymentTerm"
        pagination:
          $ref: "#/components/schemas/Pagination"
    PaymentTermCreateBody:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: Name of the payment term
        description:
          type: string
          description: Description of the payment term
        days:
          type: integer
          description: Number of days for payment
        discount_percentage:
          type: number
          format: float
          description: Discount percentage if paid early
        discount_days:
          type: integer
          description: Number of days for discount eligibility
        is_active:
          type: boolean
          description: Whether the payment term is active
          default: true
    PaymentTermCreateResult:
      type: object
      properties:
        success:
          type: boolean
        result:
          $ref: "#/components/schemas/PaymentTerm"
    PaymentTermGetResult:
      type: object
      properties:
        success:
          type: boolean
        result:
          $ref: "#/components/schemas/PaymentTerm"
    PaymentTermUpdateBody:
      type: object
      properties:
        name:
          type: string
          description: Name of the payment term
        description:
          type: string
          description: Description of the payment term
        days:
          type: integer
          description: Number of days for payment
        discount_percentage:
          type: number
          format: float
          description: Discount percentage if paid early
        discount_days:
          type: integer
          description: Number of days for discount eligibility
        is_active:
          type: boolean
          description: Whether the payment term is active
    PaymentTermUpdateResult:
      type: object
      properties:
        success:
          type: boolean
        result:
          $ref: "#/components/schemas/PaymentTerm"
    PaymentTermRemoveResult:
      type: object
      properties:
        success:
          type: boolean
        result:
          type: object
    PaymentTerm:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier
        name:
          type: string
          description: Name of the payment term
        description:
          type: string
          description: Description of the payment term
        days:
          type: integer
          description: Number of days for payment
        discount_percentage:
          type: number
          format: float
          description: Discount percentage if paid early
        discount_days:
          type: integer
          description: Number of days for discount eligibility
        is_active:
          type: boolean
          description: Whether the payment term is active
        created_at:
          type: string
          format: date-time
          description: Creation timestamp
        updated_at:
          type: string
          format: date-time
          description: Last update timestamp
        company_id:
          type: string
          description: Company identifier
    Pagination:
      type: object
      properties:
        total:
          type: integer
          description: Total number of items
        page:
          type: integer
          description: Current page number
        per_page:
          type: integer
          description: Items per page
        total_pages:
          type: integer
          description: Total number of pages
    PaymentFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Payment"
        meta:
          type: object
    PaymentCreateBody:
      type: object
      properties:
        client:
          type: string
        rep:
          type: string
        amount:
          type: number
        paymentMethod:
          type: string
        reference:
          type: string
        description:
          type: string
        date:
          type: string
          format: date-time
    PaymentCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Payment"
    PaymentGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Payment"
    PaymentUpdateBody:
      type: object
      properties:
        client:
          type: string
        rep:
          type: string
        amount:
          type: number
        paymentMethod:
          type: string
        reference:
          type: string
        description:
          type: string
        date:
          type: string
          format: date-time
    PaymentUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Payment"
    Payment:
      type: object
      properties:
        _id:
          type: string
        client:
          type: string
        rep:
          type: string
        amount:
          type: number
        paymentMethod:
          type: string
        reference:
          type: string
        description:
          type: string
        date:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    PriceListItemFindResult:
      type: object
      description: Result of finding price list items
      properties:
        data:
          type: array
          items:
            allOf:
              - $ref: "#/components/schemas/PriceListItemSchema"
              - type: object
                properties:
                  product_id:
                    oneOf:
                      - type: string
                      - $ref: "#/components/schemas/ProductReference"
                  variant_id:
                    oneOf:
                      - type: string
                      - $ref: "#/components/schemas/VariantReference"
                  pricelist_id:
                    oneOf:
                      - type: string
                      - $ref: "#/components/schemas/PriceListReference"
        total_result:
          type: number
          description: Total number of price list items
        current_count:
          type: number
          description: Count of price list items in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of price list items per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    PriceListItemSchema:
      type: object
      description: Price list item schema
      properties:
        _id:
          type: string
          description: Unique identifier for the price list item
        product_id:
          type: string
          description: ID of the product
        variant_id:
          type: string
          description: ID of the variant
        pricelist_id:
          type: string
          description: ID of the price list
        price:
          type: number
          description: Price value
        disabled:
          type: boolean
          description: Whether the price list item is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    ProductReference:
      type: object
      description: Reference to a product
      properties:
        _id:
          type: string
          description: Product ID
        name:
          type: string
          description: Product name
        category:
          type: string
          description: Product category
        active:
          type: boolean
          description: Whether the product is active
        sku:
          type: string
          description: Product SKU
        barcode:
          type: string
          description: Product barcode
    VariantReference:
      type: object
      description: Reference to a variant
      properties:
        _id:
          type: string
          description: Variant ID
        name:
          type: string
          description: Variant name
        product:
          type: string
          description: Product ID
        sku:
          type: string
          description: Variant SKU
        barcode:
          type: string
          description: Variant barcode
    PriceListReference:
      type: object
      description: Reference to a price list
      properties:
        _id:
          type: string
          description: Price list ID
        name:
          type: string
          description: Price list name
    PriceListItemCreateBody:
      type: object
      description: Body for creating a price list item
      required:
        - product_id
        - variant_id
        - pricelist_id
        - price
      properties:
        product_id:
          type: string
          description: ID of the product
        variant_id:
          type: string
          description: ID of the variant
        pricelist_id:
          type: string
          description: ID of the price list
        price:
          type: number
          description: Price value
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        disabled:
          type: boolean
          description: Whether the price list item is disabled
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
    PriceListItemCreateResult:
      $ref: "#/components/schemas/PriceListItemSchema"
      description: Result of creating a price list item
    PriceListItemGetResult:
      $ref: "#/components/schemas/PriceListItemSchema"
      description: Result of getting a price list item
    PriceListItemUpdateBody:
      type: object
      description: Body for updating a price list item
      properties:
        product_id:
          type: string
          description: ID of the product
        variant_id:
          type: string
          description: ID of the variant
        pricelist_id:
          type: string
          description: ID of the price list
        price:
          type: number
          description: Price value
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        disabled:
          type: boolean
          description: Whether the price list item is disabled
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        _id:
          type: string
          description: Unique identifier for the price list item
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    PriceListItemUpdateResult:
      $ref: "#/components/schemas/PriceListItemSchema"
      description: Result of updating a price list item
    PriceListItemRemoveResult:
      $ref: "#/components/schemas/PriceListItemSchema"
      description: Result of removing a price list item
    PriceListFindResult:
      type: object
      description: Result of finding price lists
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/PriceListSchema"
        total_result:
          type: number
          description: Total number of price lists
        current_count:
          type: number
          description: Count of price lists in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of price lists per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    PriceListSchema:
      type: object
      description: Price list schema
      properties:
        _id:
          type: string
          description: Unique identifier for the price list
        name:
          type: string
          description: Name of the price list
        createdby:
          type: object
          properties:
            _id:
              type: string
              description: ID of the creator
            name:
              type: string
              description: Name of the creator
          description: Creator information
        disabled:
          type: boolean
          description: Whether the price list is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    PriceListCreateBody:
      type: object
      description: Body for creating a price list
      required:
        - name
      properties:
        name:
          type: string
          description: Name of the price list
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        disabled:
          type: boolean
          description: Whether the price list is disabled
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
    PriceListCreateResult:
      $ref: "#/components/schemas/PriceListSchema"
      description: Result of creating a price list
    PriceListGetResult:
      $ref: "#/components/schemas/PriceListSchema"
      description: Result of getting a price list
    PriceListUpdateBody:
      type: object
      description: Body for updating a price list
      properties:
        name:
          type: string
          description: Name of the price list
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        disabled:
          type: boolean
          description: Whether the price list is disabled
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        _id:
          type: string
          description: Unique identifier for the price list
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    PriceListUpdateResult:
      $ref: "#/components/schemas/PriceListSchema"
      description: Result of updating a price list
    PriceListRemoveResult:
      $ref: "#/components/schemas/PriceListSchema"
      description: Result of removing a price list
    ProductGroupFindResult:
      type: object
      description: Result of finding product groups
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/ProductGroupSchema"
        total_result:
          type: number
          description: Total number of product groups
        current_count:
          type: number
          description: Count of product groups in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of product groups per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    ProductGroupSchema:
      type: object
      description: Product group schema
      properties:
        _id:
          type: string
          description: Unique identifier for the product group
        name:
          type: string
          description: Name of the product group
        local_name:
          type: string
          description: Localized name of the product group
        disabled:
          type: boolean
          description: Whether the product group is disabled
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    ProductGroupCreateBody:
      type: object
      description: Body for creating a product group
      required:
        - name
      properties:
        name:
          type: string
          description: Name of the product group
        local_name:
          type: string
          description: Localized name of the product group
        disabled:
          type: boolean
          description: Whether the product group is disabled
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
    ProductGroupCreateResult:
      $ref: "#/components/schemas/ProductGroupSchema"
      description: Result of creating a product group
    ProductGroupGetResult:
      $ref: "#/components/schemas/ProductGroupSchema"
      description: Result of getting a product group
    ProductGroupUpdateBody:
      type: object
      description: Body for updating a product group
      properties:
        name:
          type: string
          description: Name of the product group
        local_name:
          type: string
          description: Localized name of the product group
        disabled:
          type: boolean
          description: Whether the product group is disabled
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        _id:
          type: string
          description: Unique identifier for the product group
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    ProductGroupUpdateResult:
      $ref: "#/components/schemas/ProductGroupSchema"
      description: Result of updating a product group
    ProductGroupRemoveResult:
      $ref: "#/components/schemas/ProductGroupSchema"
      description: Result of removing a product group
    ProductModifiersGroup:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier
          example: 507f1f77bcf86cd799439011
        name:
          type: string
          description: Product modifier group name
          example: Size Options
        description:
          type: string
          description: Group description
          example: Available size options for products
        modifiers:
          type: array
          items:
            $ref: "#/components/schemas/ProductModifier"
          description: List of modifiers in this group
        is_required:
          type: boolean
          description: Whether selecting a modifier from this group is required
          example: true
        max_selection:
          type: integer
          description: Maximum number of modifiers that can be selected
          example: 1
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the group is disabled
          example: false
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        modifiedAt:
          type: string
          format: date-time
          description: Last modification timestamp
        SVClient:
          type: integer
          description: Client version
        __v:
          type: integer
          description: Document version
      required:
        - name
    ProductModifier:
      type: object
      properties:
        _id:
          type: string
          description: Modifier ID
        name:
          type: string
          description: Modifier name
          example: Large
        price_adjustment:
          type: number
          description: Price adjustment for this modifier
          example: 2.5
        description:
          type: string
          description: Modifier description
    CreateProductModifiersGroupRequest:
      type: object
      properties:
        name:
          type: string
          description: Product modifier group name
          example: Size Options
        description:
          type: string
          description: Group description
          example: Available size options for products
        modifiers:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              price_adjustment:
                type: number
              description:
                type: string
        is_required:
          type: boolean
          description: Whether selecting a modifier from this group is required
          default: false
        max_selection:
          type: integer
          description: Maximum number of modifiers that can be selected
          default: 1
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the group is disabled
          default: false
      required:
        - name
    UpdateProductModifiersGroupRequest:
      type: object
      properties:
        name:
          type: string
          description: Product modifier group name
          example: Size Options
        description:
          type: string
          description: Group description
        modifiers:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              price_adjustment:
                type: number
              description:
                type: string
        is_required:
          type: boolean
          description: Whether selecting a modifier from this group is required
        max_selection:
          type: integer
          description: Maximum number of modifiers that can be selected
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the group is disabled
    ProductFindResult:
      type: object
      description: Result of finding products
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/ProductSchema"
        total_result:
          type: number
          description: Total number of products
        current_count:
          type: number
          description: Count of products in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of products per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    ProductSchema:
      type: object
      description: Product schema
      properties:
        _id:
          type: string
          description: Unique identifier for the product
        name:
          type: string
          description: Name of the product
        category:
          type: string
          description: ID of the product category
        active:
          type: boolean
          description: Whether the product is active
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        local_name:
          type: string
          description: Localized name of the product
        sku:
          type: string
          description: Stock keeping unit
        sub_category:
          type: array
          items:
            type: string
          description: IDs of the product sub-categories
        assigned_to:
          type: array
          items:
            type: string
          description: Representatives assigned to this product
        auditable:
          type: boolean
          description: Whether the product is auditable
        barcode:
          type: string
          description: Barcode of the product
        sv_tax:
          type: string
          description: ID of the tax
        sv_measureUnit:
          type: string
          description: ID of the measure unit
        description:
          type: string
          description: Description of the product
        local_description:
          type: string
          description: Localized description of the product
        product_img:
          type: string
          description: Product image URL
        base_price:
          type: string
          description: Base price of the product
        assigned_media:
          type: array
          items:
            type: string
          description: Media assigned to this product
        html_description:
          type: string
          description: HTML description of the product
        modifiers_group:
          type: array
          items:
            type: string
          description: Modifier groups for the product
        featured:
          type: boolean
          description: Whether the product is featured
        brand:
          type: string
          description: ID of the brand
        rsp:
          type: number
          description: Recommended selling price
        measureunit_family:
          type: string
          description: ID of the measure unit family
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        teams:
          type: array
          items:
            type: string
          description: Teams
        position:
          type: number
          description: Position of the product
        product_groups:
          type: array
          items:
            type: string
          description: Product groups
        frozen_pre_sales:
          type: boolean
          description: Whether pre-sales are frozen
        frozen_sales:
          type: boolean
          description: Whether sales are frozen
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    ProductCreateBody:
      type: object
      description: Body for creating a product
      required:
        - name
        - category
      properties:
        name:
          type: string
          description: Name of the product
        category:
          type: string
          description: ID of the product category
        active:
          type: boolean
          description: Whether the product is active
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        local_name:
          type: string
          description: Localized name of the product
        sku:
          type: string
          description: Stock keeping unit
        sub_category:
          type: array
          items:
            type: string
          description: IDs of the product sub-categories
        assigned_to:
          type: array
          items:
            type: string
          description: Representatives assigned to this product
        auditable:
          type: boolean
          description: Whether the product is auditable
        barcode:
          type: string
          description: Barcode of the product
        sv_tax:
          type: string
          description: ID of the tax
        sv_measureUnit:
          type: string
          description: ID of the measure unit
        description:
          type: string
          description: Description of the product
        local_description:
          type: string
          description: Localized description of the product
        product_img:
          type: string
          description: Product image URL
        base_price:
          type: string
          description: Base price of the product
        assigned_media:
          type: array
          items:
            type: string
          description: Media assigned to this product
        html_description:
          type: string
          description: HTML description of the product
        modifiers_group:
          type: array
          items:
            type: string
          description: Modifier groups for the product
        featured:
          type: boolean
          description: Whether the product is featured
        brand:
          type: string
          description: ID of the brand
        rsp:
          type: number
          description: Recommended selling price
        measureunit_family:
          type: string
          description: ID of the measure unit family
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        teams:
          type: array
          items:
            type: string
          description: Teams
        position:
          type: number
          description: Position of the product
        product_groups:
          type: array
          items:
            type: string
          description: Product groups
        frozen_pre_sales:
          type: boolean
          description: Whether pre-sales are frozen
        frozen_sales:
          type: boolean
          description: Whether sales are frozen
        variants:
          type: array
          items:
            $ref: "#/components/schemas/VariantCreateBody"
          description: List of variants for this product
    ProductCreateResult:
      $ref: "#/components/schemas/ProductSchema"
      description: Result of creating a product
    ProductGetResult:
      $ref: "#/components/schemas/ProductSchema"
      description: Result of getting a product
    ProductUpdateBody:
      type: object
      description: Body for updating a product
      properties:
        name:
          type: string
          description: Name of the product
        category:
          type: string
          description: ID of the product category
        active:
          type: boolean
          description: Whether the product is active
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        local_name:
          type: string
          description: Localized name of the product
        sku:
          type: string
          description: Stock keeping unit
        sub_category:
          type: array
          items:
            type: string
          description: IDs of the product sub-categories
        assigned_to:
          type: array
          items:
            type: string
          description: Representatives assigned to this product
        auditable:
          type: boolean
          description: Whether the product is auditable
        barcode:
          type: string
          description: Barcode of the product
        sv_tax:
          type: string
          description: ID of the tax
        sv_measureUnit:
          type: string
          description: ID of the measure unit
        description:
          type: string
          description: Description of the product
        local_description:
          type: string
          description: Localized description of the product
        product_img:
          type: string
          description: Product image URL
        base_price:
          type: string
          description: Base price of the product
        assigned_media:
          type: array
          items:
            type: string
          description: Media assigned to this product
        html_description:
          type: string
          description: HTML description of the product
        modifiers_group:
          type: array
          items:
            type: string
          description: Modifier groups for the product
        featured:
          type: boolean
          description: Whether the product is featured
        brand:
          type: string
          description: ID of the brand
        rsp:
          type: number
          description: Recommended selling price
        measureunit_family:
          type: string
          description: ID of the measure unit family
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        teams:
          type: array
          items:
            type: string
          description: Teams
        position:
          type: number
          description: Position of the product
        product_groups:
          type: array
          items:
            type: string
          description: Product groups
        frozen_pre_sales:
          type: boolean
          description: Whether pre-sales are frozen
        frozen_sales:
          type: boolean
          description: Whether sales are frozen
        _id:
          type: string
          description: Unique identifier for the product
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
        variants:
          type: array
          items:
            allOf:
              - $ref: "#/components/schemas/VariantCreateBody"
              - type: object
                properties:
                  _id:
                    type: string
                    description: Unique identifier for the variant
          description: List of variants for this product
    ProductUpdateResult:
      $ref: "#/components/schemas/ProductSchema"
      description: Result of updating a product
    ProductRemoveResult:
      $ref: "#/components/schemas/ProductSchema"
      description: Result of removing a product
    VariantCreateBody:
      type: object
      description: Body for creating a variant
      required:
        - name
        - product
        - price
      properties:
        name:
          type: string
          description: Name of the variant
        product:
          type: string
          description: ID of the product this variant belongs to
        price:
          type: number
          description: Price of the variant
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        disabled:
          type: boolean
          description: Whether the variant is disabled
        uuid:
          type: string
          description: UUID for the variant
        local_name:
          type: string
          description: Localized name of the variant
        sku:
          type: string
          description: Stock keeping unit
        barcode:
          type: string
          description: Barcode of the variant
        weight:
          type: number
          description: Weight of the variant
        length:
          type: number
          description: Length of the variant
        width:
          type: number
          description: Width of the variant
        height:
          type: number
          description: Height of the variant
        position:
          type: number
          description: Position of the variant
        default:
          type: boolean
          description: Whether this is the default variant
        variant_img:
          type: string
          description: Image URL for the variant
        modifiers_groups:
          type: array
          items:
            type: string
          description: Modifier groups for the variant
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    ProformaFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Proforma"
        meta:
          type: object
    ProformaCreateBody:
      type: object
      properties:
        serial:
          type: string
        client:
          type: string
        rep:
          type: string
        warehouse:
          type: string
        items:
          type: array
          items:
            type: object
        total:
          type: number
        status:
          type: string
        validUntil:
          type: string
          format: date-time
    ProformaCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Proforma"
    ProformaGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Proforma"
    ProformaUpdateBody:
      type: object
      properties:
        serial:
          type: string
        client:
          type: string
        rep:
          type: string
        warehouse:
          type: string
        items:
          type: array
          items:
            type: object
        total:
          type: number
        status:
          type: string
        validUntil:
          type: string
          format: date-time
    ProformaUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Proforma"
    Proforma:
      type: object
      properties:
        _id:
          type: string
        serial:
          type: string
        client:
          type: string
        rep:
          type: string
        warehouse:
          type: string
        items:
          type: array
          items:
            type: object
        total:
          type: number
        status:
          type: string
        validUntil:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    QuickConvertToPdfBody:
      type: object
      description: Body for converting document to PDF
      required:
        - documentType
        - documentId
      properties:
        documentType:
          type: string
          enum:
            - invoice
            - proforma
            - order
            - quote
            - receipt
          description: Type of document to convert
        documentId:
          type: string
          description: ID of the document to convert
        template:
          type: string
          description: Template to use for PDF generation
        options:
          type: object
          properties:
            includeHeader:
              type: boolean
              description: Whether to include header in PDF
            includeFooter:
              type: boolean
              description: Whether to include footer in PDF
            watermark:
              type: string
              description: Watermark text to add to PDF
            orientation:
              type: string
              enum:
                - portrait
                - landscape
              description: Page orientation
            format:
              type: string
              enum:
                - A4
                - A3
                - Letter
              description: Page format
          description: PDF generation options
        language:
          type: string
          description: Language for the PDF content
    QuickConvertToPdfResult:
      type: object
      description: Result of PDF conversion
      properties:
        success:
          type: boolean
          description: Whether conversion was successful
        pdfUrl:
          type: string
          description: URL to download the generated PDF
        filename:
          type: string
          description: Generated PDF filename
        size:
          type: number
          description: PDF file size in bytes
        pages:
          type: number
          description: Number of pages in the PDF
        generatedAt:
          type: string
          format: date-time
          description: When the PDF was generated
        expiresAt:
          type: string
          format: date-time
          description: When the PDF download link expires
    ReceivingMaterialFindResult:
      type: object
      description: Result of finding receiving materials
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/ReceivingMaterialSchema"
        total_result:
          type: number
          description: Total number of receiving materials
        current_count:
          type: number
          description: Count of receiving materials in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of receiving materials per page
    ReceivingMaterialSchema:
      type: object
      description: Receiving material schema
      properties:
        _id:
          type: string
          description: Unique identifier for the receiving material
        warehouse:
          type: string
          description: Warehouse ID where materials are received
        supplier:
          type: string
          description: Supplier ID providing the materials
        rep:
          type: string
          description: Representative ID who received the materials
        receiptNumber:
          type: string
          description: Receipt number
        receiptDate:
          type: string
          format: date-time
          description: Date when materials were received
        items:
          type: array
          items:
            type: object
            properties:
              product:
                type: string
                description: Product ID
              variant:
                type: string
                description: Product variant ID
              expectedQuantity:
                type: number
                description: Expected quantity to receive
              receivedQuantity:
                type: number
                description: Actually received quantity
              unitCost:
                type: number
                description: Unit cost of the item
              totalCost:
                type: number
                description: Total cost for this item
          description: List of items received
        totalAmount:
          type: number
          description: Total amount of the receipt
        status:
          type: string
          enum:
            - pending
            - received
            - cancelled
          description: Status of the receiving material
        notes:
          type: string
          description: Additional notes
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    ReceivingMaterialCreateBody:
      type: object
      description: Body for creating a receiving material
      required:
        - warehouse
        - supplier
        - items
      properties:
        warehouse:
          type: string
          description: Warehouse ID where materials are received
        supplier:
          type: string
          description: Supplier ID providing the materials
        rep:
          type: string
          description: Representative ID who received the materials
        receiptNumber:
          type: string
          description: Receipt number
        receiptDate:
          type: string
          format: date-time
          description: Date when materials were received
        items:
          type: array
          items:
            type: object
            properties:
              product:
                type: string
                description: Product ID
              variant:
                type: string
                description: Product variant ID
              expectedQuantity:
                type: number
                description: Expected quantity to receive
              receivedQuantity:
                type: number
                description: Actually received quantity
              unitCost:
                type: number
                description: Unit cost of the item
          description: List of items received
        notes:
          type: string
          description: Additional notes
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    ReceivingMaterialCreateResult:
      $ref: "#/components/schemas/ReceivingMaterialSchema"
      description: Result of creating a receiving material
    ReceivingMaterialGetResult:
      $ref: "#/components/schemas/ReceivingMaterialSchema"
      description: Result of getting a receiving material
    ReceivingMaterialUpdateBody:
      type: object
      description: Body for updating a receiving material
      properties:
        receiptDate:
          type: string
          format: date-time
          description: Date when materials were received
        items:
          type: array
          items:
            type: object
            properties:
              product:
                type: string
                description: Product ID
              variant:
                type: string
                description: Product variant ID
              expectedQuantity:
                type: number
                description: Expected quantity to receive
              receivedQuantity:
                type: number
                description: Actually received quantity
              unitCost:
                type: number
                description: Unit cost of the item
          description: List of items received
        status:
          type: string
          enum:
            - pending
            - received
            - cancelled
          description: Status of the receiving material
        notes:
          type: string
          description: Additional notes
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    ReceivingMaterialUpdateResult:
      $ref: "#/components/schemas/ReceivingMaterialSchema"
      description: Result of updating a receiving material
    RefundFindResult:
      type: object
      description: Result of finding refunds
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/RefundSchema"
        total_result:
          type: number
          description: Total number of refunds
        current_count:
          type: number
          description: Count of refunds in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of refunds per page
    RefundSchema:
      type: object
      description: Refund schema
      properties:
        _id:
          type: string
          description: Unique identifier for the refund
        client:
          type: string
          description: Client ID associated with the refund
        rep:
          type: string
          description: Representative ID who processed the refund
        invoice:
          type: string
          description: Invoice ID being refunded
        amount:
          type: number
          description: Refund amount
        reason:
          type: string
          description: Reason for the refund
        status:
          type: string
          enum:
            - pending
            - approved
            - rejected
            - processed
          description: Status of the refund
        refundMethod:
          type: string
          description: Method of refund
        reference:
          type: string
          description: Reference number for the refund
        notes:
          type: string
          description: Additional notes
        processedAt:
          type: string
          format: date-time
          description: When the refund was processed
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    RefundCreateBody:
      type: object
      description: Body for creating a refund
      required:
        - client
        - amount
        - reason
      properties:
        client:
          type: string
          description: Client ID associated with the refund
        rep:
          type: string
          description: Representative ID who processed the refund
        invoice:
          type: string
          description: Invoice ID being refunded
        amount:
          type: number
          description: Refund amount
        reason:
          type: string
          description: Reason for the refund
        refundMethod:
          type: string
          description: Method of refund
        reference:
          type: string
          description: Reference number for the refund
        notes:
          type: string
          description: Additional notes
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    RefundCreateResult:
      $ref: "#/components/schemas/RefundSchema"
      description: Result of creating a refund
    RefundGetResult:
      $ref: "#/components/schemas/RefundSchema"
      description: Result of getting a refund
    RefundUpdateBody:
      type: object
      description: Body for updating a refund
      properties:
        status:
          type: string
          enum:
            - pending
            - approved
            - rejected
            - processed
          description: Status of the refund
        refundMethod:
          type: string
          description: Method of refund
        reference:
          type: string
          description: Reference number for the refund
        notes:
          type: string
          description: Additional notes
        processedAt:
          type: string
          format: date-time
          description: When the refund was processed
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    RefundUpdateResult:
      $ref: "#/components/schemas/RefundSchema"
      description: Result of updating a refund
    RepBalanceSummary:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the rep balance summary
        rep:
          type: string
          description: Rep ID
        rep_name:
          type: string
          description: Rep name
        total_outstanding_balance_of_invoices_created_by_rep:
          type: number
          description: Total outstanding balance of invoices created by the rep
      required:
        - _id
        - rep
        - rep_name
        - total_outstanding_balance_of_invoices_created_by_rep
    RepFindResult:
      type: object
      description: Result of finding reps
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/RepSchema"
        total_result:
          type: number
          description: Total number of reps
        current_count:
          type: number
          description: Count of reps in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of reps per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    RepSchema:
      type: object
      description: Rep schema
      properties:
        _id:
          type: string
          description: Unique identifier for the rep
        name:
          type: string
          description: Name of the rep
        email:
          type: string
          description: Email of the rep
        username:
          type: string
          description: Username of the rep
        phone:
          type: string
          description: Phone number of the rep
        role:
          type: string
          description: Role of the rep
        team_id:
          type: string
          description: ID of the team the rep belongs to
        password:
          type: string
          description: Password for the rep account
        disabled:
          type: boolean
          description: Whether the rep is disabled
        permissions:
          type: object
          description: Rep permissions
          properties:
            rep_can_add_client:
              type: boolean
              description: Can rep add clients
            rep_can_edit_client:
              type: boolean
              description: Can rep edit clients
            rep_can_add_calendar:
              type: boolean
              description: Can rep add to calendar
            rep_can_edit_calendar:
              type: boolean
              description: Can rep edit calendar
        settings:
          type: object
          description: Rep settings
          properties:
            allowable_accuracy:
              type: number
              description: Allowable GPS accuracy
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    RepCreateBody:
      type: object
      description: Body for creating a rep
      required:
        - name
        - email
        - password
        - role
        - company_namespace
      properties:
        name:
          type: string
          description: Name of the rep
        email:
          type: string
          description: Email of the rep
        username:
          type: string
          description: Username of the rep
        phone:
          type: string
          description: Phone number of the rep
        role:
          type: string
          description: Role of the rep
        team_id:
          type: string
          description: ID of the team the rep belongs to
        password:
          type: string
          description: Password for the rep account
        disabled:
          type: boolean
          description: Whether the rep is disabled
        permissions:
          type: object
          description: Rep permissions
          properties:
            rep_can_add_client:
              type: boolean
              description: Can rep add clients
            rep_can_edit_client:
              type: boolean
              description: Can rep edit clients
        settings:
          type: object
          description: Rep settings
          properties:
            allowable_accuracy:
              type: number
              description: Allowable GPS accuracy
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
    RepCreateResult:
      $ref: "#/components/schemas/RepSchema"
      description: Result of creating a rep
    RepGetResult:
      $ref: "#/components/schemas/RepSchema"
      description: Result of getting a rep
    RepUpdateBody:
      type: object
      description: Body for updating a rep
      properties:
        name:
          type: string
          description: Name of the rep
        email:
          type: string
          description: Email of the rep
        username:
          type: string
          description: Username of the rep
        phone:
          type: string
          description: Phone number of the rep
        role:
          type: string
          description: Role of the rep
        team_id:
          type: string
          description: ID of the team the rep belongs to
        password:
          type: string
          description: Password for the rep account
        disabled:
          type: boolean
          description: Whether the rep is disabled
        permissions:
          type: object
          description: Rep permissions
          properties:
            rep_can_add_client:
              type: boolean
              description: Can rep add clients
            rep_can_edit_client:
              type: boolean
              description: Can rep edit clients
        settings:
          type: object
          description: Rep settings
          properties:
            allowable_accuracy:
              type: number
              description: Allowable GPS accuracy
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        _id:
          type: string
          description: Unique identifier for the rep
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    RepUpdateResult:
      $ref: "#/components/schemas/RepSchema"
      description: Result of updating a rep
    RepRemoveResult:
      $ref: "#/components/schemas/RepSchema"
      description: Result of removing a rep
    ReturnAssetPartUnit:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the return
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        returnNumber:
          type: string
          description: Unique return number
          example: RET-2023-001
        assetPartUnit:
          type: string
          description: Asset part unit ID being returned
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        serialNumber:
          type: string
          description: Serial number of the part unit
          example: SN-EP001-2023-001
        returnType:
          type: string
          enum:
            - warranty
            - defective
            - excess
            - end-of-lease
            - maintenance
          description: Type of return
          example: defective
        returnReason:
          type: string
          description: Reason for return
          example: Part failed after 30 days of use
        returnedBy:
          type: string
          description: User who initiated the return
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        authorizedBy:
          type: string
          description: User who authorized the return
          example: 60f7b1b3e4b0e8b3f8b3f8b6
        returnDate:
          type: string
          format: date-time
          description: Date when the return was processed
          example: "2023-01-15T10:00:00Z"
        requestDate:
          type: string
          format: date-time
          description: Date when the return was requested
          example: "2023-01-14T10:00:00Z"
        originalInstallDate:
          type: string
          format: date-time
          description: Original installation date
          example: "2023-01-01T10:00:00Z"
        originalWorkOrder:
          type: string
          description: Original work order ID
          example: 60f7b1b3e4b0e8b3f8b3f8b7
        originalAsset:
          type: string
          description: Original asset ID where it was installed
          example: 60f7b1b3e4b0e8b3f8b3f8b8
        status:
          type: string
          enum:
            - requested
            - approved
            - in-transit
            - received
            - processed
            - completed
            - rejected
          default: requested
          description: Status of the return
        condition:
          type: string
          enum:
            - new
            - good
            - fair
            - poor
            - damaged
            - defective
          description: Condition of the returned part
          example: defective
        returnLocation:
          type: object
          properties:
            warehouse:
              type: string
              description: Warehouse where part is returned
            section:
              type: string
              description: Section within warehouse
            shelf:
              type: string
              description: Shelf identifier
            position:
              type: string
              description: Position on shelf
        supplier:
          type: string
          description: Supplier ID if returning to supplier
        creditAmount:
          type: number
          format: double
          minimum: 0
          description: Credit amount for the return
        currency:
          type: string
          description: Currency code
          example: USD
        replacementRequired:
          type: boolean
          default: false
          description: Whether a replacement is required
        replacementPartUnit:
          type: string
          description: Replacement part unit ID if applicable
        warrantyStatus:
          type: string
          enum:
            - in-warranty
            - out-of-warranty
            - extended-warranty
          description: Warranty status at time of return
        qualityInspection:
          type: object
          properties:
            performed:
              type: boolean
              default: false
              description: Whether quality inspection was performed
            inspectedBy:
              type: string
              description: User who performed inspection
            inspectionDate:
              type: string
              format: date-time
              description: Inspection date
            findings:
              type: string
              description: Inspection findings
            disposition:
              type: string
              enum:
                - scrap
                - rework
                - return-to-supplier
                - restock
              description: Disposition based on inspection
        documents:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              url:
                type: string
                format: uri
              type:
                type: string
                enum:
                  - return-authorization
                  - photo
                  - inspection-report
                  - other
        notes:
          type: string
          description: Additional notes
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - returnNumber
        - assetPartUnit
        - returnType
        - returnReason
        - returnedBy
    ReturnAssetPartUnitInput:
      type: object
      properties:
        returnNumber:
          type: string
          description: Unique return number
          example: RET-2023-001
        assetPartUnit:
          type: string
          description: Asset part unit ID being returned
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        serialNumber:
          type: string
          description: Serial number of the part unit
          example: SN-EP001-2023-001
        returnType:
          type: string
          enum:
            - warranty
            - defective
            - excess
            - end-of-lease
            - maintenance
          description: Type of return
          example: defective
        returnReason:
          type: string
          description: Reason for return
          example: Part failed after 30 days of use
        returnedBy:
          type: string
          description: User who initiated the return
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        authorizedBy:
          type: string
          description: User who authorized the return
          example: 60f7b1b3e4b0e8b3f8b3f8b6
        returnDate:
          type: string
          format: date-time
          description: Date when the return was processed
          example: "2023-01-15T10:00:00Z"
        requestDate:
          type: string
          format: date-time
          description: Date when the return was requested
          example: "2023-01-14T10:00:00Z"
        originalInstallDate:
          type: string
          format: date-time
          description: Original installation date
          example: "2023-01-01T10:00:00Z"
        originalWorkOrder:
          type: string
          description: Original work order ID
          example: 60f7b1b3e4b0e8b3f8b3f8b7
        originalAsset:
          type: string
          description: Original asset ID where it was installed
          example: 60f7b1b3e4b0e8b3f8b3f8b8
        status:
          type: string
          enum:
            - requested
            - approved
            - in-transit
            - received
            - processed
            - completed
            - rejected
          default: requested
          description: Status of the return
        condition:
          type: string
          enum:
            - new
            - good
            - fair
            - poor
            - damaged
            - defective
          description: Condition of the returned part
          example: defective
        returnLocation:
          type: object
          properties:
            warehouse:
              type: string
              description: Warehouse where part is returned
            section:
              type: string
              description: Section within warehouse
            shelf:
              type: string
              description: Shelf identifier
            position:
              type: string
              description: Position on shelf
        supplier:
          type: string
          description: Supplier ID if returning to supplier
        creditAmount:
          type: number
          format: double
          minimum: 0
          description: Credit amount for the return
        currency:
          type: string
          description: Currency code
          example: USD
        replacementRequired:
          type: boolean
          default: false
          description: Whether a replacement is required
        replacementPartUnit:
          type: string
          description: Replacement part unit ID if applicable
        warrantyStatus:
          type: string
          enum:
            - in-warranty
            - out-of-warranty
            - extended-warranty
          description: Warranty status at time of return
        qualityInspection:
          type: object
          properties:
            performed:
              type: boolean
              default: false
              description: Whether quality inspection was performed
            inspectedBy:
              type: string
              description: User who performed inspection
            inspectionDate:
              type: string
              format: date-time
              description: Inspection date
            findings:
              type: string
              description: Inspection findings
            disposition:
              type: string
              enum:
                - scrap
                - rework
                - return-to-supplier
                - restock
              description: Disposition based on inspection
        documents:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              url:
                type: string
                format: uri
              type:
                type: string
                enum:
                  - return-authorization
                  - photo
                  - inspection-report
                  - other
        notes:
          type: string
          description: Additional notes
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - returnNumber
        - assetPartUnit
        - returnType
        - returnReason
        - returnedBy
    ReturnReasonFindResult:
      type: object
      description: Result of finding return reasons
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/ReturnReasonSchema"
        total_result:
          type: number
          description: Total number of return reasons
        current_count:
          type: number
          description: Count of return reasons in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of return reasons per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    ReturnReasonSchema:
      type: object
      description: Return reason schema
      properties:
        _id:
          type: string
          description: Unique identifier for the return reason
        name:
          type: string
          description: Name of the return reason
        local_name:
          type: string
          description: Localized name of the return reason
        disabled:
          type: boolean
          description: Whether the return reason is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    ReturnReasonCreateBody:
      type: object
      description: Body for creating a return reason
      required:
        - name
      properties:
        name:
          type: string
          description: Name of the return reason
        local_name:
          type: string
          description: Localized name of the return reason
        disabled:
          type: boolean
          description: Whether the return reason is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
    ReturnReasonCreateResult:
      $ref: "#/components/schemas/ReturnReasonSchema"
      description: Result of creating a return reason
    ReturnReasonGetResult:
      $ref: "#/components/schemas/ReturnReasonSchema"
      description: Result of getting a return reason
    ReturnReasonUpdateBody:
      type: object
      description: Body for updating a return reason
      properties:
        name:
          type: string
          description: Name of the return reason
        local_name:
          type: string
          description: Localized name of the return reason
        disabled:
          type: boolean
          description: Whether the return reason is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        _id:
          type: string
          description: Unique identifier for the return reason
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    ReturnReasonUpdateResult:
      $ref: "#/components/schemas/ReturnReasonSchema"
      description: Result of updating a return reason
    ReturnReasonRemoveResult:
      $ref: "#/components/schemas/ReturnReasonSchema"
      description: Result of removing a return reason
    RouteFindResult:
      type: object
      description: Result of finding routes
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/RouteSchema"
        total_result:
          type: number
          description: Total number of routes
        current_count:
          type: number
          description: Count of routes in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of routes per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    RouteSchema:
      type: object
      description: Route schema
      properties:
        _id:
          type: string
          description: Unique identifier for the route
        name:
          type: string
          description: Name of the route
        rep_id:
          type: string
          description: ID of the assigned rep
        day:
          type: string
          enum:
            - sat
            - sun
            - mon
            - tue
            - wed
            - thu
            - fri
          description: Day of the week for the route
        clients:
          type: array
          description: List of clients on this route
          items:
            type: object
            properties:
              client_id:
                type: string
                description: Client ID
              priority:
                type: number
                description: Priority order of the client
        disabled:
          type: boolean
          description: Whether the route is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    RouteCreateBody:
      type: object
      description: Body for creating a route
      required:
        - name
        - rep_id
        - day
        - company_namespace
      properties:
        name:
          type: string
          description: Name of the route
        rep_id:
          type: string
          description: ID of the assigned rep
        day:
          type: string
          enum:
            - sat
            - sun
            - mon
            - tue
            - wed
            - thu
            - fri
          description: Day of the week for the route
        clients:
          type: array
          description: List of clients on this route
          items:
            type: object
            properties:
              client_id:
                type: string
                description: Client ID
              priority:
                type: number
                description: Priority order of the client
        disabled:
          type: boolean
          description: Whether the route is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
    RouteCreateResult:
      $ref: "#/components/schemas/RouteSchema"
      description: Result of creating a route
    RouteGetResult:
      $ref: "#/components/schemas/RouteSchema"
      description: Result of getting a route
    RouteUpdateBody:
      type: object
      description: Body for updating a route
      properties:
        name:
          type: string
          description: Name of the route
        rep_id:
          type: string
          description: ID of the assigned rep
        day:
          type: string
          enum:
            - sat
            - sun
            - mon
            - tue
            - wed
            - thu
            - fri
          description: Day of the week for the route
        clients:
          type: array
          description: List of clients on this route
          items:
            type: object
            properties:
              client_id:
                type: string
                description: Client ID
              priority:
                type: number
                description: Priority order of the client
        disabled:
          type: boolean
          description: Whether the route is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        _id:
          type: string
          description: Unique identifier for the route
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    RouteUpdateResult:
      $ref: "#/components/schemas/RouteSchema"
      description: Result of updating a route
    RouteRemoveResult:
      $ref: "#/components/schemas/RouteSchema"
      description: Result of removing a route
    SafeInvoiceSerialCounter:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier
          example: 507f1f77bcf86cd799439011
        rep:
          type: string
          description: Representative ID
          example: 507f1f77bcf86cd799439012
        warehouse:
          type: string
          description: Warehouse ID
          example: 507f1f77bcf86cd799439013
        invoice_type:
          type: string
          description: Type of invoice
          enum:
            - sales
            - return
            - proforma
          example: sales
        current_serial:
          type: integer
          description: Current serial number
          example: 1000
        last_used_date:
          type: string
          format: date-time
          description: Date when serial was last used
        prefix:
          type: string
          description: Serial number prefix
          example: INV-2024-
        suffix:
          type: string
          description: Serial number suffix
        pad_length:
          type: integer
          description: Length to pad the serial number
          example: 6
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        modifiedAt:
          type: string
          format: date-time
          description: Last modification timestamp
        SVClient:
          type: integer
          description: Client version
        __v:
          type: integer
          description: Document version
      required:
        - rep
        - warehouse
        - invoice_type
        - current_serial
    CreateSafeInvoiceSerialCounterRequest:
      type: object
      properties:
        rep:
          type: string
          description: Representative ID
          example: 507f1f77bcf86cd799439012
        warehouse:
          type: string
          description: Warehouse ID
          example: 507f1f77bcf86cd799439013
        invoice_type:
          type: string
          description: Type of invoice
          enum:
            - sales
            - return
            - proforma
          example: sales
        current_serial:
          type: integer
          description: Starting serial number
          default: 0
        prefix:
          type: string
          description: Serial number prefix
          example: INV-2024-
        suffix:
          type: string
          description: Serial number suffix
        pad_length:
          type: integer
          description: Length to pad the serial number
          default: 6
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
      required:
        - rep
        - warehouse
        - invoice_type
    UpdateSafeInvoiceSerialCounterRequest:
      type: object
      properties:
        current_serial:
          type: integer
          description: Current serial number
        prefix:
          type: string
          description: Serial number prefix
        suffix:
          type: string
          description: Serial number suffix
        pad_length:
          type: integer
          description: Length to pad the serial number
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
    SettingsFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Settings"
        meta:
          type: object
    SettingsGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Settings"
    SettingsUpdateBody:
      type: object
      properties:
        key:
          type: string
        value:
          oneOf:
            - type: string
            - type: number
            - type: boolean
            - type: object
        category:
          type: string
        description:
          type: string
    SettingsUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Settings"
    Settings:
      type: object
      properties:
        _id:
          type: string
        key:
          type: string
        value:
          oneOf:
            - type: string
            - type: number
            - type: boolean
            - type: object
        category:
          type: string
        description:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    SettlementFindResult:
      type: object
      description: Result of finding settlements
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/SettlementSchema"
        total_result:
          type: number
          description: Total number of settlements
        current_count:
          type: number
          description: Count of settlements in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of settlements per page
    SettlementSchema:
      type: object
      description: Settlement schema
      properties:
        _id:
          type: string
          description: Unique identifier for the settlement
        client:
          type: string
          description: Client ID associated with the settlement
        rep:
          type: string
          description: Representative ID who processed the settlement
        invoices:
          type: array
          items:
            type: object
            properties:
              invoice:
                type: string
                description: Invoice ID
              amount:
                type: number
                description: Amount from this invoice
          description: List of invoices included in settlement
        payments:
          type: array
          items:
            type: object
            properties:
              payment:
                type: string
                description: Payment ID
              amount:
                type: number
                description: Payment amount
          description: List of payments included in settlement
        totalAmount:
          type: number
          description: Total settlement amount
        status:
          type: string
          enum:
            - pending
            - completed
            - cancelled
          description: Status of the settlement
        settlementDate:
          type: string
          format: date-time
          description: Date when settlement was completed
        notes:
          type: string
          description: Additional notes
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    SettlementCreateBody:
      type: object
      description: Body for creating a settlement
      required:
        - client
        - invoices
        - payments
      properties:
        client:
          type: string
          description: Client ID associated with the settlement
        rep:
          type: string
          description: Representative ID who processed the settlement
        invoices:
          type: array
          items:
            type: object
            properties:
              invoice:
                type: string
                description: Invoice ID
              amount:
                type: number
                description: Amount from this invoice
          description: List of invoices included in settlement
        payments:
          type: array
          items:
            type: object
            properties:
              payment:
                type: string
                description: Payment ID
              amount:
                type: number
                description: Payment amount
          description: List of payments included in settlement
        notes:
          type: string
          description: Additional notes
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    SettlementCreateResult:
      $ref: "#/components/schemas/SettlementSchema"
      description: Result of creating a settlement
    SettlementGetResult:
      $ref: "#/components/schemas/SettlementSchema"
      description: Result of getting a settlement
    Speciality:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier
          example: 507f1f77bcf86cd799439011
        name:
          type: string
          description: Speciality name
          example: Cardiology
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the speciality is disabled
          example: false
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        modifiedAt:
          type: string
          format: date-time
          description: Last modification timestamp
        SVClient:
          type: integer
          description: Client version
        __v:
          type: integer
          description: Document version
      required:
        - name
    CreateSpecialityRequest:
      type: object
      properties:
        name:
          type: string
          description: Speciality name
          example: Cardiology
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the speciality is disabled
          default: false
      required:
        - name
    UpdateSpecialityRequest:
      type: object
      properties:
        name:
          type: string
          description: Speciality name
          example: Cardiology
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the speciality is disabled
    StoreAssetPartUnit:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the storage record
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        storageNumber:
          type: string
          description: Unique storage number
          example: STR-2023-001
        assetPartUnit:
          type: string
          description: Asset part unit ID being stored
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        serialNumber:
          type: string
          description: Serial number of the part unit
          example: SN-EP001-2023-001
        storageType:
          type: string
          enum:
            - inventory
            - spare
            - buffer
            - quarantine
            - maintenance
          description: Type of storage
          example: inventory
        storageReason:
          type: string
          description: Reason for storage
          example: New inventory received
        storedBy:
          type: string
          description: User who stored the part
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        authorizedBy:
          type: string
          description: User who authorized the storage
          example: 60f7b1b3e4b0e8b3f8b3f8b6
        storageDate:
          type: string
          format: date-time
          description: Date when the part was stored
          example: "2023-01-15T10:00:00Z"
        expectedRetrievalDate:
          type: string
          format: date-time
          description: Expected retrieval date
          example: "2023-06-15T10:00:00Z"
        location:
          type: object
          properties:
            warehouse:
              type: string
              description: Warehouse ID
            section:
              type: string
              description: Section within warehouse
            shelf:
              type: string
              description: Shelf identifier
            position:
              type: string
              description: Position on shelf
            bin:
              type: string
              description: Bin identifier
            coordinates:
              type: object
              properties:
                x:
                  type: number
                  description: X coordinate
                "y":
                  type: number
                  description: Y coordinate
                z:
                  type: number
                  description: Z coordinate (height)
        status:
          type: string
          enum:
            - stored
            - reserved
            - allocated
            - picked
            - expired
          default: stored
          description: Current storage status
        condition:
          type: string
          enum:
            - new
            - good
            - fair
            - poor
            - damaged
          description: Condition when stored
          example: new
        storageEnvironment:
          type: object
          properties:
            temperature:
              type: object
              properties:
                min:
                  type: number
                  description: Minimum temperature
                max:
                  type: number
                  description: Maximum temperature
                unit:
                  type: string
                  enum:
                    - celsius
                    - fahrenheit
                  default: celsius
            humidity:
              type: object
              properties:
                min:
                  type: number
                  description: Minimum humidity percentage
                max:
                  type: number
                  description: Maximum humidity percentage
            specialRequirements:
              type: array
              items:
                type: string
                enum:
                  - dry
                  - cool
                  - dark
                  - ventilated
                  - climate-controlled
        preservationMethod:
          type: string
          enum:
            - none
            - plastic-wrap
            - desiccant
            - vacuum-seal
            - oil-coating
          default: none
          description: Preservation method used
        lastInspectionDate:
          type: string
          format: date-time
          description: Last inspection date
        nextInspectionDate:
          type: string
          format: date-time
          description: Next scheduled inspection date
        reservedFor:
          type: object
          properties:
            workOrder:
              type: string
              description: Work order ID if reserved
            asset:
              type: string
              description: Asset ID if reserved
            project:
              type: string
              description: Project ID if reserved
            reservationDate:
              type: string
              format: date-time
              description: Reservation date
            reservedBy:
              type: string
              description: User who made the reservation
        tags:
          type: array
          items:
            type: string
          description: Storage tags for categorization
        barcode:
          type: string
          description: Storage barcode
        qrCode:
          type: string
          description: Storage QR code
        weight:
          type: number
          format: double
          minimum: 0
          description: Weight of the stored item
        dimensions:
          type: object
          properties:
            length:
              type: number
              format: double
              minimum: 0
            width:
              type: number
              format: double
              minimum: 0
            height:
              type: number
              format: double
              minimum: 0
            unit:
              type: string
              enum:
                - mm
                - cm
                - m
                - inch
                - ft
              default: cm
        storageHistory:
          type: array
          items:
            type: object
            properties:
              date:
                type: string
                format: date-time
              action:
                type: string
                enum:
                  - stored
                  - moved
                  - inspected
                  - reserved
                  - released
              performedBy:
                type: string
              fromLocation:
                type: string
              toLocation:
                type: string
              notes:
                type: string
        notes:
          type: string
          description: Additional notes
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - storageNumber
        - assetPartUnit
        - storageType
        - storedBy
        - location
    StoreAssetPartUnitInput:
      type: object
      properties:
        storageNumber:
          type: string
          description: Unique storage number
          example: STR-2023-001
        assetPartUnit:
          type: string
          description: Asset part unit ID being stored
          example: 60f7b1b3e4b0e8b3f8b3f8b4
        serialNumber:
          type: string
          description: Serial number of the part unit
          example: SN-EP001-2023-001
        storageType:
          type: string
          enum:
            - inventory
            - spare
            - buffer
            - quarantine
            - maintenance
          description: Type of storage
          example: inventory
        storageReason:
          type: string
          description: Reason for storage
          example: New inventory received
        storedBy:
          type: string
          description: User who stored the part
          example: 60f7b1b3e4b0e8b3f8b3f8b5
        authorizedBy:
          type: string
          description: User who authorized the storage
          example: 60f7b1b3e4b0e8b3f8b3f8b6
        storageDate:
          type: string
          format: date-time
          description: Date when the part was stored
          example: "2023-01-15T10:00:00Z"
        expectedRetrievalDate:
          type: string
          format: date-time
          description: Expected retrieval date
          example: "2023-06-15T10:00:00Z"
        location:
          type: object
          properties:
            warehouse:
              type: string
              description: Warehouse ID
            section:
              type: string
              description: Section within warehouse
            shelf:
              type: string
              description: Shelf identifier
            position:
              type: string
              description: Position on shelf
            bin:
              type: string
              description: Bin identifier
            coordinates:
              type: object
              properties:
                x:
                  type: number
                  description: X coordinate
                "y":
                  type: number
                  description: Y coordinate
                z:
                  type: number
                  description: Z coordinate (height)
        status:
          type: string
          enum:
            - stored
            - reserved
            - allocated
            - picked
            - expired
          default: stored
          description: Current storage status
        condition:
          type: string
          enum:
            - new
            - good
            - fair
            - poor
            - damaged
          description: Condition when stored
          example: new
        storageEnvironment:
          type: object
          properties:
            temperature:
              type: object
              properties:
                min:
                  type: number
                  description: Minimum temperature
                max:
                  type: number
                  description: Maximum temperature
                unit:
                  type: string
                  enum:
                    - celsius
                    - fahrenheit
                  default: celsius
            humidity:
              type: object
              properties:
                min:
                  type: number
                  description: Minimum humidity percentage
                max:
                  type: number
                  description: Maximum humidity percentage
            specialRequirements:
              type: array
              items:
                type: string
                enum:
                  - dry
                  - cool
                  - dark
                  - ventilated
                  - climate-controlled
        preservationMethod:
          type: string
          enum:
            - none
            - plastic-wrap
            - desiccant
            - vacuum-seal
            - oil-coating
          default: none
          description: Preservation method used
        lastInspectionDate:
          type: string
          format: date-time
          description: Last inspection date
        nextInspectionDate:
          type: string
          format: date-time
          description: Next scheduled inspection date
        reservedFor:
          type: object
          properties:
            workOrder:
              type: string
              description: Work order ID if reserved
            asset:
              type: string
              description: Asset ID if reserved
            project:
              type: string
              description: Project ID if reserved
            reservationDate:
              type: string
              format: date-time
              description: Reservation date
            reservedBy:
              type: string
              description: User who made the reservation
        tags:
          type: array
          items:
            type: string
          description: Storage tags for categorization
        barcode:
          type: string
          description: Storage barcode
        qrCode:
          type: string
          description: Storage QR code
        weight:
          type: number
          format: double
          minimum: 0
          description: Weight of the stored item
        dimensions:
          type: object
          properties:
            length:
              type: number
              format: double
              minimum: 0
            width:
              type: number
              format: double
              minimum: 0
            height:
              type: number
              format: double
              minimum: 0
            unit:
              type: string
              enum:
                - mm
                - cm
                - m
                - inch
                - ft
              default: cm
        notes:
          type: string
          description: Additional notes
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - storageNumber
        - assetPartUnit
        - storageType
        - storedBy
        - location
    StorecheckTemplateFindResult:
      type: object
      description: Result of finding storecheck templates
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/StorecheckTemplateSchema"
        total_result:
          type: number
          description: Total number of storecheck templates
        current_count:
          type: number
          description: Count of storecheck templates in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of storecheck templates per page
    StorecheckTemplateSchema:
      type: object
      description: Storecheck template schema
      properties:
        _id:
          type: string
          description: Unique identifier for the storecheck template
        name:
          type: string
          description: Name of the storecheck template
        description:
          type: string
          description: Description of the template
        category:
          type: string
          description: Category of the storecheck
        sections:
          type: array
          items:
            type: object
            properties:
              title:
                type: string
                description: Section title
              questions:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      description: Question ID
                    text:
                      type: string
                      description: Question text
                    type:
                      type: string
                      enum:
                        - text
                        - number
                        - boolean
                        - multiple_choice
                        - photo
                        - signature
                      description: Question type
                    required:
                      type: boolean
                      description: Whether question is required
                    options:
                      type: array
                      items:
                        type: string
                      description: Options for multiple choice questions
                description: Questions in this section
          description: Template sections and questions
        targets:
          type: array
          items:
            type: string
          description: Target entities (clients, routes, etc.)
        frequency:
          type: string
          enum:
            - daily
            - weekly
            - monthly
            - quarterly
            - yearly
            - custom
          description: Frequency of storecheck execution
        validFrom:
          type: string
          format: date-time
          description: Start date of template validity
        validTo:
          type: string
          format: date-time
          description: End date of template validity
        disabled:
          type: boolean
          description: Whether the template is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    StorecheckTemplateCreateBody:
      type: object
      description: Body for creating a storecheck template
      required:
        - name
        - sections
      properties:
        name:
          type: string
          description: Name of the storecheck template
        description:
          type: string
          description: Description of the template
        category:
          type: string
          description: Category of the storecheck
        sections:
          type: array
          items:
            type: object
            properties:
              title:
                type: string
                description: Section title
              questions:
                type: array
                items:
                  type: object
                  properties:
                    text:
                      type: string
                      description: Question text
                    type:
                      type: string
                      enum:
                        - text
                        - number
                        - boolean
                        - multiple_choice
                        - photo
                        - signature
                      description: Question type
                    required:
                      type: boolean
                      description: Whether question is required
                    options:
                      type: array
                      items:
                        type: string
                      description: Options for multiple choice questions
                description: Questions in this section
          description: Template sections and questions
        targets:
          type: array
          items:
            type: string
          description: Target entities (clients, routes, etc.)
        frequency:
          type: string
          enum:
            - daily
            - weekly
            - monthly
            - quarterly
            - yearly
            - custom
          description: Frequency of storecheck execution
        validFrom:
          type: string
          format: date-time
          description: Start date of template validity
        validTo:
          type: string
          format: date-time
          description: End date of template validity
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    StorecheckTemplateCreateResult:
      $ref: "#/components/schemas/StorecheckTemplateSchema"
      description: Result of creating a storecheck template
    StorecheckTemplateGetResult:
      $ref: "#/components/schemas/StorecheckTemplateSchema"
      description: Result of getting a storecheck template
    StorecheckTemplateUpdateBody:
      type: object
      description: Body for updating a storecheck template
      properties:
        name:
          type: string
          description: Name of the storecheck template
        description:
          type: string
          description: Description of the template
        category:
          type: string
          description: Category of the storecheck
        sections:
          type: array
          items:
            type: object
            properties:
              title:
                type: string
                description: Section title
              questions:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                      description: Question ID
                    text:
                      type: string
                      description: Question text
                    type:
                      type: string
                      enum:
                        - text
                        - number
                        - boolean
                        - multiple_choice
                        - photo
                        - signature
                      description: Question type
                    required:
                      type: boolean
                      description: Whether question is required
                    options:
                      type: array
                      items:
                        type: string
                      description: Options for multiple choice questions
                description: Questions in this section
          description: Template sections and questions
        targets:
          type: array
          items:
            type: string
          description: Target entities (clients, routes, etc.)
        frequency:
          type: string
          enum:
            - daily
            - weekly
            - monthly
            - quarterly
            - yearly
            - custom
          description: Frequency of storecheck execution
        validFrom:
          type: string
          format: date-time
          description: Start date of template validity
        validTo:
          type: string
          format: date-time
          description: End date of template validity
        disabled:
          type: boolean
          description: Whether the template is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    StorecheckTemplateUpdateResult:
      $ref: "#/components/schemas/StorecheckTemplateSchema"
      description: Result of updating a storecheck template
    StorecheckTemplateRemoveResult:
      $ref: "#/components/schemas/StorecheckTemplateSchema"
      description: Result of removing a storecheck template
    SubCategoryFindResult:
      type: object
      description: Result of finding subcategories
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/SubCategorySchema"
        total_result:
          type: number
          description: Total number of subcategories
        current_count:
          type: number
          description: Count of subcategories in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of subcategories per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    SubCategorySchema:
      type: object
      description: SubCategory schema
      properties:
        _id:
          type: string
          description: Unique identifier for the subcategory
        name:
          type: string
          description: Name of the subcategory
        parent_id:
          oneOf:
            - type: string
              description: ID of the parent category
            - type: object
              properties:
                _id:
                  type: string
                  description: ID of the parent category
                name:
                  type: string
                  description: Name of the parent category
              description: Parent category object when populated
        local_name:
          type: string
          description: Localized name of the subcategory
        disabled:
          type: boolean
          description: Whether the subcategory is disabled
        photo:
          type: string
          description: Photo URL of the subcategory
        position:
          type: number
          description: Position of the subcategory
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    SubCategoryCreateBody:
      type: object
      description: Body for creating a subcategory
      required:
        - name
        - parent_id
      properties:
        name:
          type: string
          description: Name of the subcategory
        parent_id:
          type: string
          description: ID of the parent category
        local_name:
          type: string
          description: Localized name of the subcategory
        disabled:
          type: boolean
          description: Whether the subcategory is disabled
        photo:
          type: string
          description: Photo URL of the subcategory
        position:
          type: number
          description: Position of the subcategory
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    SubCategoryCreateResult:
      $ref: "#/components/schemas/SubCategorySchema"
      description: Result of creating a subcategory
    SubCategoryGetResult:
      $ref: "#/components/schemas/SubCategorySchema"
      description: Result of getting a subcategory
    SubCategoryUpdateBody:
      type: object
      description: Body for updating a subcategory
      properties:
        name:
          type: string
          description: Name of the subcategory
        parent_id:
          type: string
          description: ID of the parent category
        local_name:
          type: string
          description: Localized name of the subcategory
        disabled:
          type: boolean
          description: Whether the subcategory is disabled
        photo:
          type: string
          description: Photo URL of the subcategory
        position:
          type: number
          description: Position of the subcategory
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        _id:
          type: string
          description: Unique identifier for the subcategory
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    SubCategoryUpdateResult:
      $ref: "#/components/schemas/SubCategorySchema"
      description: Result of updating a subcategory
    SubCategoryRemoveResult:
      $ref: "#/components/schemas/SubCategorySchema"
      description: Result of removing a subcategory
    SupplierFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Supplier"
        meta:
          type: object
    SupplierCreateBody:
      type: object
      properties:
        name:
          type: string
        email:
          type: string
          format: email
        phone:
          type: string
        address:
          type: object
        integration_meta:
          type: object
        disabled:
          type: boolean
    SupplierCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Supplier"
    SupplierGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Supplier"
    SupplierUpdateBody:
      type: object
      properties:
        name:
          type: string
        email:
          type: string
          format: email
        phone:
          type: string
        address:
          type: object
        integration_meta:
          type: object
        disabled:
          type: boolean
    SupplierUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Supplier"
    SupplierRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    Supplier:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        email:
          type: string
          format: email
        phone:
          type: string
        address:
          type: object
        integration_meta:
          type: object
        disabled:
          type: boolean
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    SvixIntegration:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the Svix integration
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        name:
          type: string
          description: Name of the integration
          example: Webhook Integration
        description:
          type: string
          description: Description of the integration
        applicationId:
          type: string
          description: Svix application ID
          example: app_12345
        endpointUrl:
          type: string
          format: uri
          description: Webhook endpoint URL
          example: https://example.com/webhook
        eventTypes:
          type: array
          items:
            type: string
          description: List of event types to subscribe to
          example:
            - user.created
            - order.updated
        secret:
          type: string
          description: Webhook secret for signature verification
        isActive:
          type: boolean
          default: true
          description: Whether the integration is active
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - name
        - applicationId
        - endpointUrl
    SvixIntegrationInput:
      type: object
      properties:
        name:
          type: string
          description: Name of the integration
          example: Webhook Integration
        description:
          type: string
          description: Description of the integration
        applicationId:
          type: string
          description: Svix application ID
          example: app_12345
        endpointUrl:
          type: string
          format: uri
          description: Webhook endpoint URL
          example: https://example.com/webhook
        eventTypes:
          type: array
          items:
            type: string
          description: List of event types to subscribe to
          example:
            - user.created
            - order.updated
        secret:
          type: string
          description: Webhook secret for signature verification
        isActive:
          type: boolean
          default: true
          description: Whether the integration is active
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - name
        - applicationId
        - endpointUrl
    TagFindResult:
      type: object
      description: Result of finding tags
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/TagSchema"
        total_result:
          type: number
          description: Total number of tags
        current_count:
          type: number
          description: Count of tags in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of tags per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    TagSchema:
      type: object
      description: Tag schema
      properties:
        _id:
          type: string
          description: Unique identifier for the tag
        name:
          type: string
          description: Name of the tag
        disabled:
          type: boolean
          description: Whether the tag is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    TagCreateBody:
      type: object
      description: Body for creating a tag
      required:
        - name
        - company_namespace
      properties:
        name:
          type: string
          description: Name of the tag
        disabled:
          type: boolean
          description: Whether the tag is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
    TagCreateResult:
      $ref: "#/components/schemas/TagSchema"
      description: Result of creating a tag
    TagGetResult:
      $ref: "#/components/schemas/TagSchema"
      description: Result of getting a tag
    TagUpdateBody:
      type: object
      description: Body for updating a tag
      properties:
        name:
          type: string
          description: Name of the tag
        disabled:
          type: boolean
          description: Whether the tag is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        _id:
          type: string
          description: Unique identifier for the tag
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    TagUpdateResult:
      $ref: "#/components/schemas/TagSchema"
      description: Result of updating a tag
    TagRemoveResult:
      $ref: "#/components/schemas/TagSchema"
      description: Result of removing a tag
    TaxFindResult:
      type: object
      description: Result of finding taxes
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/TaxSchema"
        total_result:
          type: number
          description: Total number of taxes
        current_count:
          type: number
          description: Count of taxes in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of taxes per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    TaxSchema:
      type: object
      description: Tax schema
      properties:
        _id:
          type: string
          description: Unique identifier for the tax
        name:
          type: string
          description: Name of the tax
        rate:
          type: number
          description: Tax rate
        type:
          type: string
          enum:
            - inclusive
            - additive
            - N/A
          description: Type of tax (inclusive, additive, or N/A)
        disabled:
          type: boolean
          description: Whether the tax is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    TaxCreateBody:
      type: object
      description: Body for creating a tax
      required:
        - name
        - rate
        - type
      properties:
        name:
          type: string
          description: Name of the tax
        rate:
          type: number
          description: Tax rate
        type:
          type: string
          enum:
            - inclusive
            - additive
            - N/A
          description: Type of tax
        disabled:
          type: boolean
          description: Whether the tax is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
    TaxCreateResult:
      $ref: "#/components/schemas/TaxSchema"
      description: Result of creating a tax
    TaxGetResult:
      $ref: "#/components/schemas/TaxSchema"
      description: Result of getting a tax
    TaxUpdateBody:
      type: object
      description: Body for updating a tax
      properties:
        name:
          type: string
          description: Name of the tax
        rate:
          type: number
          description: Tax rate
        type:
          type: string
          enum:
            - inclusive
            - additive
            - N/A
          description: Type of tax
        disabled:
          type: boolean
          description: Whether the tax is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        _id:
          type: string
          description: Unique identifier for the tax
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    TaxUpdateResult:
      $ref: "#/components/schemas/TaxSchema"
      description: Result of updating a tax
    TaxRemoveResult:
      $ref: "#/components/schemas/TaxSchema"
      description: Result of removing a tax
    TeamFindResult:
      type: object
      description: Result of finding teams
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/TeamSchema"
        total_result:
          type: number
          description: Total number of teams
        current_count:
          type: number
          description: Count of teams in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of teams per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    TeamSchema:
      type: object
      description: Team schema
      properties:
        _id:
          type: string
          description: Unique identifier for the team
        name:
          type: string
          description: Name of the team
        disabled:
          type: boolean
          description: Whether the team is disabled
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    TeamCreateBody:
      type: object
      description: Body for creating a team
      required:
        - name
      properties:
        name:
          type: string
          description: Name of the team
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        disabled:
          type: boolean
          description: Whether the team is disabled
    TeamCreateResult:
      $ref: "#/components/schemas/TeamSchema"
      description: Result of creating a team
    TeamGetResult:
      allOf:
        - $ref: "#/components/schemas/TeamSchema"
        - type: object
          properties:
            admins:
              description: Administrators associated with the team
            reps:
              description: Representatives associated with the team
      description: Result of getting a team
    TeamUpdateBody:
      type: object
      description: Body for updating a team
      properties:
        name:
          type: string
          description: Name of the team
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        disabled:
          type: boolean
          description: Whether the team is disabled
        _id:
          type: string
          description: Unique identifier for the team
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    TeamUpdateResult:
      $ref: "#/components/schemas/TeamSchema"
      description: Result of updating a team
    TeamRemoveResult:
      $ref: "#/components/schemas/TeamSchema"
      description: Result of removing a team
    TransferFindResult:
      type: object
      description: Result of finding transfers
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/TransferSchema"
        total_result:
          type: number
          description: Total number of transfers
        current_count:
          type: number
          description: Count of transfers in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of transfers per page
    TransferSchema:
      type: object
      description: Transfer schema
      properties:
        _id:
          type: string
          description: Unique identifier for the transfer
        transferNumber:
          type: string
          description: Transfer reference number
        fromWarehouse:
          type: string
          description: Source warehouse ID
        toWarehouse:
          type: string
          description: Destination warehouse ID
        rep:
          type: string
          description: Representative ID who initiated the transfer
        transferDate:
          type: string
          format: date-time
          description: Date when transfer was initiated
        expectedDate:
          type: string
          format: date-time
          description: Expected delivery date
        completedDate:
          type: string
          format: date-time
          description: Date when transfer was completed
        status:
          type: string
          enum:
            - pending
            - in_transit
            - completed
            - cancelled
          description: Status of the transfer
        items:
          type: array
          items:
            type: object
            properties:
              product:
                type: string
                description: Product ID
              variant:
                type: string
                description: Product variant ID
              requestedQuantity:
                type: number
                description: Requested quantity to transfer
              sentQuantity:
                type: number
                description: Actually sent quantity
              receivedQuantity:
                type: number
                description: Actually received quantity
              unitCost:
                type: number
                description: Unit cost of the item
          description: List of items being transferred
        totalValue:
          type: number
          description: Total value of the transfer
        reason:
          type: string
          description: Reason for the transfer
        notes:
          type: string
          description: Additional notes
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    TransferCreateBody:
      type: object
      description: Body for creating a transfer
      required:
        - fromWarehouse
        - toWarehouse
        - items
      properties:
        fromWarehouse:
          type: string
          description: Source warehouse ID
        toWarehouse:
          type: string
          description: Destination warehouse ID
        rep:
          type: string
          description: Representative ID who initiated the transfer
        expectedDate:
          type: string
          format: date-time
          description: Expected delivery date
        items:
          type: array
          items:
            type: object
            properties:
              product:
                type: string
                description: Product ID
              variant:
                type: string
                description: Product variant ID
              requestedQuantity:
                type: number
                description: Requested quantity to transfer
              unitCost:
                type: number
                description: Unit cost of the item
          description: List of items being transferred
        reason:
          type: string
          description: Reason for the transfer
        notes:
          type: string
          description: Additional notes
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    TransferCreateResult:
      $ref: "#/components/schemas/TransferSchema"
      description: Result of creating a transfer
    TransferGetResult:
      $ref: "#/components/schemas/TransferSchema"
      description: Result of getting a transfer
    TransferUpdateBody:
      type: object
      description: Body for updating a transfer
      properties:
        expectedDate:
          type: string
          format: date-time
          description: Expected delivery date
        status:
          type: string
          enum:
            - pending
            - in_transit
            - completed
            - cancelled
          description: Status of the transfer
        items:
          type: array
          items:
            type: object
            properties:
              product:
                type: string
                description: Product ID
              variant:
                type: string
                description: Product variant ID
              requestedQuantity:
                type: number
                description: Requested quantity to transfer
              sentQuantity:
                type: number
                description: Actually sent quantity
              receivedQuantity:
                type: number
                description: Actually received quantity
              unitCost:
                type: number
                description: Unit cost of the item
          description: List of items being transferred
        notes:
          type: string
          description: Additional notes
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
    TransferUpdateResult:
      $ref: "#/components/schemas/TransferSchema"
      description: Result of updating a transfer
    UpdateIntegrationMeta:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier for the integration meta update
          example: 60f7b1b3e4b0e8b3f8b3f8b3
        name:
          type: string
          description: Name of the meta update
          example: Update API Version
        description:
          type: string
          description: Description of the meta update
        targetIntegrations:
          type: array
          items:
            type: string
          description: List of integration IDs to update
        metaUpdates:
          type: object
          additionalProperties: true
          description: Metadata fields to update
          example:
            apiVersion: v2.0
            timeout: 30000
            retryCount: 3
        conditions:
          type: object
          additionalProperties: true
          description: Conditions for applying the update
        status:
          type: string
          enum:
            - draft
            - ready
            - applied
            - failed
            - cancelled
          default: draft
          description: Status of the meta update
        appliedAt:
          type: string
          format: date-time
          description: When the update was applied
        appliedBy:
          type: string
          description: User who applied the update
        affectedCount:
          type: integer
          minimum: 0
          description: Number of integrations affected
        rollbackData:
          type: object
          additionalProperties: true
          description: Data needed for rollback
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
        createdAt:
          type: string
          format: date-time
          description: Record creation timestamp
          example: "2023-01-15T08:00:00Z"
        updatedAt:
          type: string
          format: date-time
          description: Record last update timestamp
          example: "2023-01-15T10:30:00Z"
      required:
        - name
        - metaUpdates
    UpdateIntegrationMetaInput:
      type: object
      properties:
        name:
          type: string
          description: Name of the meta update
          example: Update API Version
        description:
          type: string
          description: Description of the meta update
        targetIntegrations:
          type: array
          items:
            type: string
          description: List of integration IDs to update
        metaUpdates:
          type: object
          additionalProperties: true
          description: Metadata fields to update
          example:
            apiVersion: v2.0
            timeout: 30000
            retryCount: 3
        conditions:
          type: object
          additionalProperties: true
          description: Conditions for applying the update
        status:
          type: string
          enum:
            - draft
            - ready
            - applied
            - failed
            - cancelled
          default: draft
          description: Status of the meta update
        metadata:
          type: object
          additionalProperties: true
          description: Additional metadata
      required:
        - name
        - metaUpdates
    VariantFindResult:
      type: object
      description: Result of finding variants
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/VariantSchema"
        total_result:
          type: number
          description: Total number of variants
        current_count:
          type: number
          description: Count of variants in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of variants per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    VariantSchema:
      type: object
      description: Variant schema
      properties:
        _id:
          type: string
          description: Unique identifier for the variant
        name:
          type: string
          description: Name of the variant
        product:
          type: string
          description: ID of the product this variant belongs to
        price:
          type: number
          description: Price of the variant
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        disabled:
          type: boolean
          description: Whether the variant is disabled
        uuid:
          type: string
          description: UUID for the variant
        local_name:
          type: string
          description: Localized name of the variant
        sku:
          type: string
          description: Stock keeping unit
        barcode:
          type: string
          description: Barcode of the variant
        weight:
          type: number
          description: Weight of the variant
        length:
          type: number
          description: Length of the variant
        width:
          type: number
          description: Width of the variant
        height:
          type: number
          description: Height of the variant
        position:
          type: number
          description: Position of the variant
        default:
          type: boolean
          description: Whether this is the default variant
        variant_img:
          type: string
          description: Image URL for the variant
        modifiers_groups:
          type: array
          items:
            type: string
          description: Modifier groups for the variant
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    VariantCreateResult:
      type: object
      description: Result of creating a variant
      properties:
        $ref: "#/components/schemas/VariantSchema"
    VariantGetResult:
      $ref: "#/components/schemas/VariantSchema"
      description: Result of getting a variant
    VariantUpdateBody:
      type: object
      description: Body for updating a variant
      properties:
        name:
          type: string
          description: Name of the variant
        product:
          type: string
          description: ID of the product this variant belongs to
        price:
          type: number
          description: Price of the variant
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        disabled:
          type: boolean
          description: Whether the variant is disabled
        uuid:
          type: string
          description: UUID for the variant
        local_name:
          type: string
          description: Localized name of the variant
        sku:
          type: string
          description: Stock keeping unit
        barcode:
          type: string
          description: Barcode of the variant
        weight:
          type: number
          description: Weight of the variant
        length:
          type: number
          description: Length of the variant
        width:
          type: number
          description: Width of the variant
        height:
          type: number
          description: Height of the variant
        position:
          type: number
          description: Position of the variant
        default:
          type: boolean
          description: Whether this is the default variant
        variant_img:
          type: string
          description: Image URL for the variant
        modifiers_groups:
          type: array
          items:
            type: string
          description: Modifier groups for the variant
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        _id:
          type: string
          description: Unique identifier for the variant
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    VariantUpdateResult:
      $ref: "#/components/schemas/VariantSchema"
      description: Result of updating a variant
    VariantRemoveResult:
      $ref: "#/components/schemas/VariantSchema"
      description: Result of removing a variant
    VisitFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Visit"
        meta:
          type: object
    VisitCreateBody:
      type: object
      properties:
        client:
          type: string
        rep:
          type: string
        plannedDate:
          type: string
          format: date-time
        actualDate:
          type: string
          format: date-time
        status:
          type: string
          enum:
            - planned
            - completed
            - cancelled
        notes:
          type: string
        location:
          type: object
    VisitCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Visit"
    VisitGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Visit"
    VisitUpdateBody:
      type: object
      properties:
        client:
          type: string
        rep:
          type: string
        plannedDate:
          type: string
          format: date-time
        actualDate:
          type: string
          format: date-time
        status:
          type: string
          enum:
            - planned
            - completed
            - cancelled
        notes:
          type: string
        location:
          type: object
    VisitUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Visit"
    Visit:
      type: object
      properties:
        _id:
          type: string
        client:
          type: string
        rep:
          type: string
        plannedDate:
          type: string
          format: date-time
        actualDate:
          type: string
          format: date-time
        status:
          type: string
          enum:
            - planned
            - completed
            - cancelled
        notes:
          type: string
        location:
          type: object
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    WarehouseFindResult:
      type: object
      description: Result of finding warehouses
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/WarehouseSchema"
        total_result:
          type: number
          description: Total number of warehouses
        current_count:
          type: number
          description: Count of warehouses in current page
        total_pages:
          type: number
          description: Total number of pages
        current_page:
          type: number
          description: Current page number
        per_page:
          type: number
          description: Number of warehouses per page
        first_page_url:
          type: string
          description: URL for the first page
        last_page_url:
          type: string
          description: URL for the last page
        next_page_url:
          type: string
          nullable: true
          description: URL for the next page
        prev_page_url:
          type: string
          nullable: true
          description: URL for the previous page
        path:
          type: string
          description: Base URL path
    WarehouseSchema:
      type: object
      description: Warehouse schema
      properties:
        _id:
          type: string
          description: Unique identifier for the warehouse
        name:
          type: string
          description: Name of the warehouse
        location:
          type: object
          description: Geographic location of the warehouse
          properties:
            type:
              type: string
              enum:
                - Point
              description: Type of geolocation
            coordinates:
              type: array
              items:
                type: number
              description: Coordinates [longitude, latitude]
        disabled:
          type: boolean
          description: Whether the warehouse is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    WarehouseCreateBody:
      type: object
      description: Body for creating a warehouse
      required:
        - name
        - company_namespace
      properties:
        name:
          type: string
          description: Name of the warehouse
        location:
          type: object
          description: Geographic location of the warehouse
          properties:
            type:
              type: string
              enum:
                - Point
              description: Type of geolocation
            coordinates:
              type: array
              items:
                type: number
              description: Coordinates [longitude, latitude]
        disabled:
          type: boolean
          description: Whether the warehouse is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
    WarehouseCreateResult:
      $ref: "#/components/schemas/WarehouseSchema"
      description: Result of creating a warehouse
    WarehouseGetResult:
      $ref: "#/components/schemas/WarehouseSchema"
      description: Result of getting a warehouse
    WarehouseUpdateBody:
      type: object
      description: Body for updating a warehouse
      properties:
        name:
          type: string
          description: Name of the warehouse
        location:
          type: object
          description: Geographic location of the warehouse
          properties:
            type:
              type: string
              enum:
                - Point
              description: Type of geolocation
            coordinates:
              type: array
              items:
                type: number
              description: Coordinates [longitude, latitude]
        disabled:
          type: boolean
          description: Whether the warehouse is disabled
        integration_meta:
          type: object
          additionalProperties: true
          description: Integration metadata
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespaces
        _id:
          type: string
          description: Unique identifier for the warehouse
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        updatedAt:
          type: string
          format: date-time
          description: Last update timestamp
        __v:
          type: number
          description: Version number
    WarehouseUpdateResult:
      $ref: "#/components/schemas/WarehouseSchema"
      description: Result of updating a warehouse
    WarehouseRemoveResult:
      $ref: "#/components/schemas/WarehouseSchema"
      description: Result of removing a warehouse
    WorkorderCategory:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier
          example: 507f1f77bcf86cd799439011
        name:
          type: string
          description: Category name
          example: Maintenance
        description:
          type: string
          description: Category description
          example: General maintenance workorders
        code:
          type: string
          description: Category code for identification
          example: MAINT
        parent_category:
          type: string
          description: Parent category ID for hierarchical structure
          example: 507f1f77bcf86cd799439012
        color:
          type: string
          description: Color code for visual identification
          example: "#FF5733"
        icon:
          type: string
          description: Icon identifier
          example: wrench
        priority_level:
          type: integer
          description: Default priority level for workorders in this category
          minimum: 1
          maximum: 5
          example: 3
        estimated_duration:
          type: integer
          description: Estimated duration in minutes
          example: 120
        required_skills:
          type: array
          items:
            type: string
          description: Skills required for this category
          example:
            - electrical
            - plumbing
        default_assignee:
          type: string
          description: Default assignee for this category
          example: 507f1f77bcf86cd799439013
        notification_settings:
          type: object
          properties:
            notify_on_creation:
              type: boolean
              description: Send notification when workorder is created
            notify_on_completion:
              type: boolean
              description: Send notification when workorder is completed
            escalation_time:
              type: integer
              description: Time in hours before escalation
        approval_required:
          type: boolean
          description: Whether approval is required for workorders in this category
          example: false
        custom_fields:
          type: array
          items:
            type: object
            properties:
              field_name:
                type: string
              field_type:
                type: string
                enum:
                  - text
                  - number
                  - date
                  - select
                  - checkbox
              is_required:
                type: boolean
              options:
                type: array
                items:
                  type: string
          description: Custom fields for this category
        sla_settings:
          type: object
          properties:
            response_time:
              type: integer
              description: Response time in hours
            resolution_time:
              type: integer
              description: Resolution time in hours
            business_hours_only:
              type: boolean
              description: Whether SLA applies only to business hours
        sort_order:
          type: integer
          description: Sort order for display
          example: 1
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the category is disabled
          example: false
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        modifiedAt:
          type: string
          format: date-time
          description: Last modification timestamp
        SVClient:
          type: integer
          description: Client version
        __v:
          type: integer
          description: Document version
      required:
        - name
    WorkorderCategoryHierarchy:
      type: object
      properties:
        _id:
          type: string
          description: Category ID
        name:
          type: string
          description: Category name
        description:
          type: string
          description: Category description
        code:
          type: string
          description: Category code
        color:
          type: string
          description: Color code
        icon:
          type: string
          description: Icon identifier
        children:
          type: array
          items:
            $ref: "#/components/schemas/WorkorderCategoryHierarchy"
          description: Child categories
        workorder_count:
          type: integer
          description: Number of workorders in this category
    CreateWorkorderCategoryRequest:
      type: object
      properties:
        name:
          type: string
          description: Category name
          example: Maintenance
        description:
          type: string
          description: Category description
          example: General maintenance workorders
        code:
          type: string
          description: Category code for identification
          example: MAINT
        parent_category:
          type: string
          description: Parent category ID for hierarchical structure
        color:
          type: string
          description: Color code for visual identification
          example: "#FF5733"
        icon:
          type: string
          description: Icon identifier
          example: wrench
        priority_level:
          type: integer
          description: Default priority level for workorders in this category
          minimum: 1
          maximum: 5
          default: 3
        estimated_duration:
          type: integer
          description: Estimated duration in minutes
        required_skills:
          type: array
          items:
            type: string
          description: Skills required for this category
        default_assignee:
          type: string
          description: Default assignee for this category
        notification_settings:
          type: object
          properties:
            notify_on_creation:
              type: boolean
              default: true
            notify_on_completion:
              type: boolean
              default: true
            escalation_time:
              type: integer
        approval_required:
          type: boolean
          description: Whether approval is required for workorders in this category
          default: false
        custom_fields:
          type: array
          items:
            type: object
            properties:
              field_name:
                type: string
              field_type:
                type: string
                enum:
                  - text
                  - number
                  - date
                  - select
                  - checkbox
              is_required:
                type: boolean
              options:
                type: array
                items:
                  type: string
        sla_settings:
          type: object
          properties:
            response_time:
              type: integer
            resolution_time:
              type: integer
            business_hours_only:
              type: boolean
              default: true
        sort_order:
          type: integer
          description: Sort order for display
          default: 0
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the category is disabled
          default: false
      required:
        - name
    UpdateWorkorderCategoryRequest:
      type: object
      properties:
        name:
          type: string
          description: Category name
        description:
          type: string
          description: Category description
        code:
          type: string
          description: Category code for identification
        parent_category:
          type: string
          description: Parent category ID for hierarchical structure
        color:
          type: string
          description: Color code for visual identification
        icon:
          type: string
          description: Icon identifier
        priority_level:
          type: integer
          description: Default priority level for workorders in this category
          minimum: 1
          maximum: 5
        estimated_duration:
          type: integer
          description: Estimated duration in minutes
        required_skills:
          type: array
          items:
            type: string
          description: Skills required for this category
        default_assignee:
          type: string
          description: Default assignee for this category
        notification_settings:
          type: object
          properties:
            notify_on_creation:
              type: boolean
            notify_on_completion:
              type: boolean
            escalation_time:
              type: integer
        approval_required:
          type: boolean
          description: Whether approval is required for workorders in this category
        custom_fields:
          type: array
          items:
            type: object
            properties:
              field_name:
                type: string
              field_type:
                type: string
                enum:
                  - text
                  - number
                  - date
                  - select
                  - checkbox
              is_required:
                type: boolean
              options:
                type: array
                items:
                  type: string
        sla_settings:
          type: object
          properties:
            response_time:
              type: integer
            resolution_time:
              type: integer
            business_hours_only:
              type: boolean
        sort_order:
          type: integer
          description: Sort order for display
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether the category is disabled
    WorkorderPortalLink:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier
          example: 507f1f77bcf86cd799439011
        workorder:
          type: string
          description: Workorder ID reference
          example: 507f1f77bcf86cd799439012
        link_token:
          type: string
          description: Unique token for the portal link
          example: wpl_abc123def456
        full_url:
          type: string
          description: Complete portal link URL
          example: https://portal.repzo.me/workorder/wpl_abc123def456
        link_type:
          type: string
          description: Type of portal link
          enum:
            - public
            - private
            - secure
          example: private
        permissions:
          type: object
          properties:
            can_view_details:
              type: boolean
              description: Can view workorder details
              default: true
            can_add_comments:
              type: boolean
              description: Can add comments
              default: true
            can_upload_files:
              type: boolean
              description: Can upload files
              default: false
            can_view_history:
              type: boolean
              description: Can view workorder history
              default: true
            can_approve_reject:
              type: boolean
              description: Can approve or reject workorder
              default: false
        access_restrictions:
          type: object
          properties:
            allowed_ips:
              type: array
              items:
                type: string
              description: Allowed IP addresses (if restricted)
            max_uses:
              type: integer
              description: Maximum number of uses
            password_protected:
              type: boolean
              description: Whether password protection is enabled
              default: false
            require_email_verification:
              type: boolean
              description: Whether email verification is required
              default: false
        expiry_date:
          type: string
          format: date-time
          description: When the portal link expires
        is_active:
          type: boolean
          description: Whether the portal link is active
          example: true
        usage_stats:
          type: object
          properties:
            total_views:
              type: integer
              description: Total number of views
              example: 15
            unique_visitors:
              type: integer
              description: Number of unique visitors
              example: 3
            last_accessed:
              type: string
              format: date-time
              description: Last access timestamp
            access_log:
              type: array
              items:
                type: object
                properties:
                  timestamp:
                    type: string
                    format: date-time
                  ip_address:
                    type: string
                  user_agent:
                    type: string
                  action:
                    type: string
              description: Access log entries
        notification_settings:
          type: object
          properties:
            notify_on_access:
              type: boolean
              description: Send notification when link is accessed
              default: false
            notify_on_comment:
              type: boolean
              description: Send notification when comment is added
              default: true
            notify_on_file_upload:
              type: boolean
              description: Send notification when file is uploaded
              default: true
            notification_recipients:
              type: array
              items:
                type: string
              description: Email addresses to notify
        custom_branding:
          type: object
          properties:
            logo_url:
              type: string
              description: Custom logo URL
            brand_color:
              type: string
              description: Brand color hex code
              example: "#FF5733"
            custom_domain:
              type: string
              description: Custom domain for the portal link
            footer_text:
              type: string
              description: Custom footer text
        metadata:
          type: object
          properties:
            created_by:
              type: string
              description: User who created the link
            purpose:
              type: string
              description: Purpose of the portal link
            tags:
              type: array
              items:
                type: string
              description: Tags for organization
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        modifiedAt:
          type: string
          format: date-time
          description: Last modification timestamp
        SVClient:
          type: integer
          description: Client version
        __v:
          type: integer
          description: Document version
      required:
        - workorder
        - link_token
        - link_type
    CreateWorkorderPortalLinkRequest:
      type: object
      properties:
        workorder:
          type: string
          description: Workorder ID reference
          example: 507f1f77bcf86cd799439012
        link_type:
          type: string
          description: Type of portal link
          enum:
            - public
            - private
            - secure
          default: private
        permissions:
          type: object
          properties:
            can_view_details:
              type: boolean
              default: true
            can_add_comments:
              type: boolean
              default: true
            can_upload_files:
              type: boolean
              default: false
            can_view_history:
              type: boolean
              default: true
            can_approve_reject:
              type: boolean
              default: false
        access_restrictions:
          type: object
          properties:
            allowed_ips:
              type: array
              items:
                type: string
            max_uses:
              type: integer
            password_protected:
              type: boolean
              default: false
            require_email_verification:
              type: boolean
              default: false
        expiry_date:
          type: string
          format: date-time
          description: When the portal link expires
        notification_settings:
          type: object
          properties:
            notify_on_access:
              type: boolean
              default: false
            notify_on_comment:
              type: boolean
              default: true
            notify_on_file_upload:
              type: boolean
              default: true
            notification_recipients:
              type: array
              items:
                type: string
        custom_branding:
          type: object
          properties:
            logo_url:
              type: string
            brand_color:
              type: string
            custom_domain:
              type: string
            footer_text:
              type: string
        metadata:
          type: object
          properties:
            purpose:
              type: string
            tags:
              type: array
              items:
                type: string
        is_active:
          type: boolean
          description: Whether the portal link is active
          default: true
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
      required:
        - workorder
    UpdateWorkorderPortalLinkRequest:
      type: object
      properties:
        link_type:
          type: string
          description: Type of portal link
          enum:
            - public
            - private
            - secure
        permissions:
          type: object
          properties:
            can_view_details:
              type: boolean
            can_add_comments:
              type: boolean
            can_upload_files:
              type: boolean
            can_view_history:
              type: boolean
            can_approve_reject:
              type: boolean
        access_restrictions:
          type: object
          properties:
            allowed_ips:
              type: array
              items:
                type: string
            max_uses:
              type: integer
            password_protected:
              type: boolean
            require_email_verification:
              type: boolean
        expiry_date:
          type: string
          format: date-time
          description: When the portal link expires
        is_active:
          type: boolean
          description: Whether the portal link is active
        notification_settings:
          type: object
          properties:
            notify_on_access:
              type: boolean
            notify_on_comment:
              type: boolean
            notify_on_file_upload:
              type: boolean
            notification_recipients:
              type: array
              items:
                type: string
        custom_branding:
          type: object
          properties:
            logo_url:
              type: string
            brand_color:
              type: string
            custom_domain:
              type: string
            footer_text:
              type: string
        metadata:
          type: object
          properties:
            purpose:
              type: string
            tags:
              type: array
              items:
                type: string
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
    WorkorderPortal:
      type: object
      properties:
        _id:
          type: string
          description: Unique identifier
          example: 507f1f77bcf86cd799439011
        workorder:
          type: string
          description: Workorder ID reference
          example: 507f1f77bcf86cd799439012
        client:
          type: string
          description: Client ID reference
          example: 507f1f77bcf86cd799439013
        portal_access_code:
          type: string
          description: Unique access code for portal
          example: WOP-2024-001
        status:
          type: string
          description: Current status
          enum:
            - pending
            - in_progress
            - completed
            - cancelled
          example: pending
        access_level:
          type: string
          description: Level of access granted
          enum:
            - view_only
            - comment
            - full_access
          example: comment
        allowed_actions:
          type: array
          items:
            type: string
            enum:
              - view
              - comment
              - upload_files
              - approve
              - reject
          description: Actions allowed for this portal access
        expiry_date:
          type: string
          format: date-time
          description: When portal access expires
        last_accessed:
          type: string
          format: date-time
          description: Last time portal was accessed
        access_count:
          type: integer
          description: Number of times portal was accessed
          example: 5
        notifications:
          type: object
          properties:
            email_enabled:
              type: boolean
              description: Whether email notifications are enabled
            sms_enabled:
              type: boolean
              description: Whether SMS notifications are enabled
            notification_events:
              type: array
              items:
                type: string
                enum:
                  - status_change
                  - new_comment
                  - deadline_approaching
        portal_settings:
          type: object
          properties:
            show_progress:
              type: boolean
              description: Whether to show progress information
            allow_comments:
              type: boolean
              description: Whether commenting is allowed
            require_authentication:
              type: boolean
              description: Whether authentication is required
        custom_branding:
          type: object
          properties:
            logo_url:
              type: string
              description: URL to custom logo
            brand_color:
              type: string
              description: Brand color hex code
              example: "#FF5733"
            company_name:
              type: string
              description: Company name to display
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether portal access is disabled
          example: false
        createdAt:
          type: string
          format: date-time
          description: Creation timestamp
        modifiedAt:
          type: string
          format: date-time
          description: Last modification timestamp
        SVClient:
          type: integer
          description: Client version
        __v:
          type: integer
          description: Document version
      required:
        - workorder
        - client
        - portal_access_code
        - status
    CreateWorkorderPortalRequest:
      type: object
      properties:
        workorder:
          type: string
          description: Workorder ID reference
          example: 507f1f77bcf86cd799439012
        client:
          type: string
          description: Client ID reference
          example: 507f1f77bcf86cd799439013
        access_level:
          type: string
          description: Level of access granted
          enum:
            - view_only
            - comment
            - full_access
          default: view_only
        allowed_actions:
          type: array
          items:
            type: string
            enum:
              - view
              - comment
              - upload_files
              - approve
              - reject
          description: Actions allowed for this portal access
          default:
            - view
        expiry_date:
          type: string
          format: date-time
          description: When portal access expires
        notifications:
          type: object
          properties:
            email_enabled:
              type: boolean
              default: true
            sms_enabled:
              type: boolean
              default: false
            notification_events:
              type: array
              items:
                type: string
                enum:
                  - status_change
                  - new_comment
                  - deadline_approaching
        portal_settings:
          type: object
          properties:
            show_progress:
              type: boolean
              default: true
            allow_comments:
              type: boolean
              default: true
            require_authentication:
              type: boolean
              default: false
        custom_branding:
          type: object
          properties:
            logo_url:
              type: string
            brand_color:
              type: string
            company_name:
              type: string
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether portal access is disabled
          default: false
      required:
        - workorder
        - client
    UpdateWorkorderPortalRequest:
      type: object
      properties:
        status:
          type: string
          description: Current status
          enum:
            - pending
            - in_progress
            - completed
            - cancelled
        access_level:
          type: string
          description: Level of access granted
          enum:
            - view_only
            - comment
            - full_access
        allowed_actions:
          type: array
          items:
            type: string
            enum:
              - view
              - comment
              - upload_files
              - approve
              - reject
        expiry_date:
          type: string
          format: date-time
          description: When portal access expires
        notifications:
          type: object
          properties:
            email_enabled:
              type: boolean
            sms_enabled:
              type: boolean
            notification_events:
              type: array
              items:
                type: string
                enum:
                  - status_change
                  - new_comment
                  - deadline_approaching
        portal_settings:
          type: object
          properties:
            show_progress:
              type: boolean
            allow_comments:
              type: boolean
            require_authentication:
              type: boolean
        custom_branding:
          type: object
          properties:
            logo_url:
              type: string
            brand_color:
              type: string
            company_name:
              type: string
        company_namespace:
          type: array
          items:
            type: string
          description: Company namespace
        disabled:
          type: boolean
          description: Whether portal access is disabled
    WorkorderRequestFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/WorkorderRequest"
        meta:
          type: object
    WorkorderRequestCreateBody:
      type: object
      properties:
        title:
          type: string
        description:
          type: string
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
        requestedBy:
          type: string
        client:
          type: string
        asset:
          type: string
        category:
          type: string
    WorkorderRequestCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/WorkorderRequest"
    WorkorderRequestGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/WorkorderRequest"
    WorkorderRequestUpdateBody:
      type: object
      properties:
        title:
          type: string
        description:
          type: string
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
        requestedBy:
          type: string
        client:
          type: string
        asset:
          type: string
        category:
          type: string
        status:
          type: string
    WorkorderRequestUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/WorkorderRequest"
    WorkorderRequestRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    WorkorderRequest:
      type: object
      properties:
        _id:
          type: string
        title:
          type: string
        description:
          type: string
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
        requestedBy:
          type: string
        client:
          type: string
        asset:
          type: string
        category:
          type: string
        status:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    WorkorderFindResult:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Workorder"
        meta:
          type: object
    WorkorderCreateBody:
      type: object
      properties:
        title:
          type: string
        description:
          type: string
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
        status:
          type: string
        assignedTo:
          type: string
        client:
          type: string
        asset:
          type: string
        category:
          type: string
        dueDate:
          type: string
          format: date-time
    WorkorderCreateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Workorder"
    WorkorderGetResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Workorder"
    WorkorderUpdateBody:
      type: object
      properties:
        title:
          type: string
        description:
          type: string
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
        status:
          type: string
        assignedTo:
          type: string
        client:
          type: string
        asset:
          type: string
        category:
          type: string
        dueDate:
          type: string
          format: date-time
    WorkorderUpdateResult:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Workorder"
    WorkorderRemoveResult:
      type: object
      properties:
        success:
          type: boolean
    Workorder:
      type: object
      properties:
        _id:
          type: string
        title:
          type: string
        description:
          type: string
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
        status:
          type: string
        assignedTo:
          type: string
        client:
          type: string
        asset:
          type: string
        category:
          type: string
        dueDate:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
tags:
  - name: Activity AI Sales Order
    description: Operations related to AI-assisted sales order activities
  - name: Activity Feedback V2
    description: Activity feedback v2 management operations
  - name: Activity Feedback
    description: Activity feedback management operations
  - name: Activity Storecheck
    description: Operations related to activity storecheck management
  - name: Asset Part Receival
    description: Operations related to asset part receival management
  - name: Asset Part Transfer
    description: Operations related to asset part transfer management
  - name: Asset Part Type
    description: Operations related to asset part type management
  - name: Asset Part Unit
    description: Operations related to asset part unit management
  - name: Asset Part
    description: Operations related to asset part management
  - name: Asset Unit
    description: Asset unit management operations
  - name: Channel
    description: Client channel management operations
  - name: Client Contact
    description: Client contact management operations
  - name: Client Location
    description: Client location management operations
  - name: Contract Installment
    description: Contract installment management operations
  - name: Feedback Options
    description: Feedback options management operations
  - name: Integration Action Log
    description: Operations related to integration action log management
  - name: Integration Command Log
    description: Operations related to integration command log management
  - name: Mail Unsubscribe
    description: Email unsubscription management operations
  - name: OCR Invoice Job Group
    description: Operations related to OCR invoice job group management
  - name: OCR Invoice Job Page
    description: Operations related to individual pages within OCR invoice jobs
  - name: OCR Invoice Job Template
    description: Operations related to OCR invoice job template management
  - name: OCR Invoice Job
    description: Operations related to individual OCR invoice job management
  - name: Patch Action
    description: Operations related to patch action management
  - name: Product Modifiers Group
    description: Product modifier group management operations
  - name: Return Asset Part Unit
    description: Operations related to returning asset part units
  - name: Safe Invoice Serial Counter
    description: Safe invoice serial counter management operations
  - name: Speciality
    description: Speciality management operations
  - name: Store Asset Part Unit
    description: Operations related to storing asset part units
  - name: Svix Integration
    description: Operations related to Svix webhook integration management
  - name: Update Integration Meta
    description: Operations related to updating integration metadata
  - name: Workorder Category
    description: Workorder category management operations
  - name: Workorder Portal Link
    description: Workorder portal link management operations
  - name: Workorder Portal
    description: Workorder portal management operations
