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