openapi: 3.0.3
info:
  title: Repzo API - Return Reason
  version: 1.0.0
  description: OpenAPI specification for Repzo Return Reason endpoints.
servers:
  - url: https://sv.api.repzo.me
paths:
  /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"
components:
  schemas:
    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
