openapi: 3.0.0
info:
  description: >-
    fabric e-commerce Offers APIs allow you to to set up and manage stock
    keeping unit (SKU) prices. Its wide range of coupon and promotion features
    let you design deals ranging from single-use, customer-specific coupons to
    site-wide promotions.
  version: 1.0.0
  title: Offers v1
  contact:
    email: support@fabric.inc
  license:
    name: fabric API license
    url: https://fabric.inc/api-license
tags:
  - name: Pricing
    description: Pricing APIs enable you to add price details for one or many items.
  - name: Promotions
    description: >-
      Promotion APIs enable you to apply and verify promotions and discount
      coupons.
  - name: Login API
    description: >-
      Login endpoint generates an authorization token for local users that they
      can use to log into fabric copilot application. <br /><br /> **Note:** A
      local user is someone who has an active account with fabric Inc
servers:
  - url: https://prod01-apigw.{customer_name}.fabric.zone
    description: Production
    variables:
      customer_name:
        default: yourcompany
        description: Customer name, provided by support team
externalDocs:
  description: Learn more about Offers
  url: https://fabric.inc/knowledgebase/offers
paths:
  /api-price/price:
    post:
      tags:
        - Pricing
      summary: Create Price
      description: >-
        Enables you to create one or many prices in accordance with how many
        items are present in the itemIds array.
      operationId: createPrice
      parameters:
        - $ref: '#/components/parameters/xSiteContent'
        - in: header
          name: x-api-key
          description: >
            The `x-api-key` enables you to access fabric APIs without
            `Authorization`. You must request fabric Inc to obtain this key.<br
            /> `Authorization` header is required if `x-api-key` is omitted.
          required: true
          schema:
            type: string
      requestBody:
        description: A JSON object that contains price information.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/commercePriceInsert'
      responses:
        '200':
          description: Successfully creates price.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/priceInsertResponse'
        '400':
          description: Client Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/clientError'
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
    get:
      tags:
        - Pricing
      summary: Get Price
      description: Retrieves paginated list of prices for all items
      operationId: priceList
      parameters:
        - name: x-site-context
          in: header
          description: >-
            The `x-site-context` header is a JSON object that contains
            information about the source you wish to pull from. The mandatory
            `account` is the 24 character identifier found in Copilot. The
            `channel` (Sales channel ID), `stage` (environment name), and `date`
            attributes can be used to further narrow the scope of your data
            source.
          required: true
          schema:
            type: string
            example: >-
              {"date": "2023-01-01T00:00:00.000Z", "channel": 12, "account":
              "1234abcd5678efgh9ijklmno","stage":"production"}
        - in: header
          name: x-api-key
          description: >
            The `x-api-key` enables you to access fabric APIs without
            Authorization. You must request fabric Inc to obtain this key.<br />
            `Authorization `header is required if `x-api-key` is omitted.
          required: true
          schema:
            type: string
        - in: query
          name: limit
          description: >-
            It limits the number of records returned by the API, default is `10`
            if `limit` is not specified.
          required: false
          example: 10
          schema:
            type: number
        - in: query
          name: offset
          description: >-
            Number of records you wish to skip before selecting records. Default
            is `0` if not specified.
          example: 0
          required: false
          schema:
            type: number
      responses:
        '200':
          description: Successfully retrieves price details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getPriceReponse'
        '400':
          description: Client error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/clientError'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
  /api-price/price/{priceId}:
    get:
      tags:
        - Pricing
      summary: Get Price Details by Price ID
      description: Enables you to get price details based on price ID
      operationId: priceById
      parameters:
        - $ref: '#/components/parameters/xSiteContent'
        - in: path
          name: priceId
          description: The ID associated with the price of an item
          required: true
          example: 1000011218
          schema:
            type: string
        - in: query
          name: priceListId
          description: PriceListId to get the price from.
          schema:
            type: string
          required: true
          example: 100000
        - in: query
          name: type
          description: The type of id that is provided in path for priceId.
          schema:
            type: string
            enum:
              - id
              - itemId
              - itemSku
          example: itemId
      responses:
        '200':
          description: Successfully retrieves price details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getPriceReponse'
        '400':
          description: Client error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/clientError'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
    delete:
      tags:
        - Pricing
      summary: Delete price by ID
      description: Deletes a price in the service by item identifier or its SKU.
      operationId: deletePrice
      security:
        - bearerAuth: []
      parameters:
        - $ref: '#/components/parameters/xSiteContent'
        - in: path
          name: priceId
          description: The mongo objectID, itemId or itemSku of the price to be retrieved
          required: true
          example: 1000011218
          schema:
            type: string
        - in: query
          name: priceListId
          description: PriceListId to get the price from.
          schema:
            type: string
          required: true
          example: 100000
        - in: query
          name: type
          description: The type of id that is provided in path for priceId.
          schema:
            type: string
            enum:
              - id
              - itemId
              - itemSku
          example: itemId
      responses:
        '200':
          description: Returns the deleted price
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/deletePriceReponse'
        '400':
          description: Client error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/clientError'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
  /api-price/offer/get-by-itemIds:
    post:
      tags:
        - Pricing
      summary: Get Offers for Items by Item IDs
      description: Enables you to get offer price of items based on the item Ids.
      operationId: getPriceByItemIds
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/getItemPriceRequest'
      parameters:
        - $ref: '#/components/parameters/xSiteContent'
      responses:
        '200':
          description: >-
            Successfully retrieves an array cotaining all the prices for items
            based on items identifiers.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/priceInsertResponse'
        '400':
          description: Client Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/clientError'
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
  /api-price/v2/price/get:
    post:
      tags:
        - Pricing
      summary: Get Prices of Items
      description: Enables you to get prices for all items.
      operationId: getItemPriceV2
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/getItemPriceByListRequest'
      parameters:
        - $ref: '#/components/parameters/xSiteContent'
      responses:
        '200':
          description: Successfully gets prices for items.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/priceInsertResponse'
        '400':
          description: Client Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/clientError'
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
  /api-price/price/bulk-insert:
    post:
      tags:
        - Pricing
      summary: Add or Update Bulk Price
      description: >-
        Enables you to add or update prices, in bulk. This API is secured by
        x-api-key.
      operationId: bulkInsert
      parameters:
        - $ref: '#/components/parameters/xSiteContent'
        - in: header
          name: x-api-key
          description: >
            The `x-api-key` enables you to access the fabric API without
            `Authorization`. You must request fabric Inc to obtain this key.<br
            />Authorization` header is required if `x-api-key` is omitted.
          required: true
          schema:
            type: string
      requestBody:
        description: Array of Items
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/createPriceWithMinQuantity'
      responses:
        '200':
          description: Successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/bulkInsetResponse'
        '400':
          description: Client error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/clientError'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
  /api-price/promo/validate:
    post:
      tags:
        - Promotions
      summary: Validate Promotions
      description: >-
        Enables you to validate a cart's promotions - coupon codes and implicit
        promotions - for specified item IDs.
      operationId: validatePromo
      parameters:
        - $ref: '#/components/parameters/xSiteContent'
      requestBody:
        description: >-
          A JSON object containing information to apply eligible promotions to
          cart items.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/validate-promo'
      responses:
        '200':
          description: Successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/cart-validation'
        '400':
          description: Client Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/clientError'
        '406':
          description: Promo is Expired
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
  /api-price/promo:
    get:
      tags:
        - Promotions
      summary: Get List of Promotions
      description: >-
        Enables you to retrieve all the active promotions, in a paginated
        response.
      operationId: promoListCommerce
      parameters:
        - $ref: '#/components/parameters/xSiteContent'
        - in: query
          name: offset
          description: >-
            Number of records you wish to skip before selecting records. Default
            is `0` if not specified
          required: false
          schema:
            type: number
        - in: query
          name: limit
          description: >-
            limits the number of records returned by the api. Default is `10` if
            `limit` is not specified
          required: false
          example: 10
          schema:
            type: number
        - name: keyword
          in: query
          description: Retrive records by SKU name
          required: false
          example: sku name test
          schema:
            type: string
      responses:
        '200':
          description: Successfully gets list of all active promotions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/promo-list'
        '400':
          description: Client error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/clientError'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
  /api-price/promo/{promoId}:
    get:
      tags:
        - Promotions
      summary: Get Promotions by promotion ID
      description: >-
        Retrieves details of a specific promotion based on the specified
        promotion ID.
      parameters:
        - $ref: '#/components/parameters/xSiteContent'
        - in: path
          name: promoId
          schema:
            type: string
          required: true
          example: '1000011218'
          description: Get promotions based on promotion ID
      operationId: getPromoCommerce
      responses:
        '200':
          description: Successfull
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/promo-single'
        '400':
          description: Client error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/clientError'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
  /api-identity/auth/local/login:
    post:
      tags:
        - Login API
      summary: Generate authorization token for local user
      description: >-
        Generates an authorization token using which you can access fabric APIs.
        Ensure that you provide valid credentials to get an authorization token.
      parameters:
        - in: header
          name: x-site-context
          description: >-
            The x-site-context is a JSON object that must contain date, and
            channel attributes. eg -
            {"date":"2020-12-12T08:00:00.000Z","channel":12}
          required: true
          schema:
            type: object
            required:
              - channel
              - date
            properties:
              channel:
                description: Sales channel
                type: number
                example: 12
              date:
                description: UTC date and time
                type: string
                format: date-time
                example: '2022-03-24T23:16:00.000Z'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/loginV1Request'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/loginV1Response'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error400'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error500'
components:
  parameters:
    xSiteContent:
      name: x-site-context
      in: header
      description: >-
        The `x-site-context` header is a JSON object that contains information
        about the source you wish to pull from. The mandatory `account` is the
        24 character identifier found in Copilot. The `channel` (Sales channel
        ID), `stage` (environment name), and `date` attributes can be used to
        further narrow the scope of your data source.
      required: true
      schema:
        type: string
        example: >-
          {"date": "2023-01-01T00:00:00.000Z", "channel": 12, "account":
          "1234abcd5678efgh9ijklmno","stage":"production"}
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    loginV1Request:
      type: object
      properties:
        accountId:
          type: number
          description: Merchant's 10 character copilot account ID
          example: 4781348886
        username:
          type: string
          description: Username or email address of the user who will log in
          example: john@fabric.inc
        password:
          type: string
          description: Password using which you log into fabric copilot UI
          example: joHn@123456789!
    loginV1Response:
      type: object
      properties:
        _id:
          type: string
          description: fabric internal ID
          example: 60c3a2c476f9c21239d836ca
        account:
          type: object
          description: Copilot account information
          properties:
            accountId:
              type: string
              description: Merchant's 10 character copilot account ID
              example: 8739392294
        roles:
          type: array
          description: List of available roles for the user
          items:
            type: string
            description: Role description, such as administrator, manager, and so on
            example: Admin
        permissions:
          type: array
          description: List of available permissions for the user
          items:
            type: string
            description: Permission description
            example: read:user
        refreshToken:
          type: object
          description: Refresh token
          example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVC.eyJpZCI6IjYwYzNhMmM0....
        accessToken:
          type: object
          description: Access Token. This is the token to consume the copilot APIs.
          example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVC.eyJpZCI6IjYwYzNhMmM0....
    error400:
      type: object
      properties:
        code:
          description: Error code.
          type: string
          example: BAD_REQUEST
        message:
          description: Error description
          type: string
          example: Bad Request
    error500:
      type: object
      properties:
        code:
          description: Error code.
          type: string
          example: INTERNAL_SERVER_ERROR
        message:
          description: Error description
          type: string
          example: Internal server error.
    getPriceReponse:
      type: object
      description: Get Price Response
      properties:
        query:
          description: >-
            Object containing the size, count and amount of pages in the
            response.
          type: object
          properties:
            limit:
              description: page size
              type: number
              example: 10
            count:
              description: total objects
              type: number
              example: 40
            page:
              description: current page
              type: number
              example: 1
        prices:
          description: An array containing all the prices in the service.
          type: array
          items:
            $ref: '#/components/schemas/priceInsertResponse'
    commercePriceInsert:
      type: object
      description: Price Insert Object.
      properties:
        priceListId:
          description: The Pricelist Id or name.
          oneOf:
            - type: number
              description: Price list identifier.
              example: 100000
            - type: string
              description: Price list name.
              example: test
        itemIds:
          description: A list of one or more identifiers of the items to be created.
          type: array
          items:
            description: Item
            type: number
            example:
              - 1000011218
        itemSkus:
          description: >-
            A list of Stock Keeping Units (SKUs) of the items to be created. If
            present, this array must have the same number of items as itemIds
            and each SKU will be associated with the ID in the same index.
          type: array
          items:
            description: Items
            type: number
            example: 1234XYZ
        offers:
          description: A list of the offers to be added and its properties.
          type: array
          maxItems: 10
          minItems: 1
          items:
            type: object
            description: Items
            properties:
              kind:
                description: Pricekind Id
                type: number
                example: 12
              channel:
                description: Channel Id
                type: number
                example: 12
              startDate:
                description: Price start date time
                type: string
                format: date-time
                example: '2021-12-30T02:05:47.234Z'
              endDate:
                description: Price end date time
                type: string
                format: date-time
                example: '2099-12-31T00:00:00.000Z'
              price:
                type: object
                description: Price
                properties:
                  base:
                    description: base price of item
                    type: number
                    example: 2000
                  sale:
                    description: sale price of item if any
                    type: number
                    example: 1000
                  cost:
                    description: Cost of item
                    type: number
                    example: 800
                  currency:
                    description: Currency
                    type: string
                    example: USD
                required:
                  - base
                  - currency
              range:
                type: array
                description: Range Prices
                minItems: 1
                items:
                  type: object
                  description: Items
                  properties:
                    minQuantity:
                      description: Minimum Quantity
                      type: number
                      example: 2
                    price:
                      description: range price of item
                      type: number
                      example: 500
            required:
              - channel
              - startDate
              - endDate
              - price
      required:
        - priceListId
        - itemIds
        - offers
    deletePriceReponse:
      type: object
      description: Create Price Response
      properties:
        _id:
          description: ID
          type: string
          example: 616e011037a3810008cfb256
        priceListId:
          description: Price List ID
          type: number
          example: 100000
        isSoftDeleted:
          description: Has been soft deleted
          type: boolean
          example: true
        itemId:
          description: Internal Item ID
          type: number
          example: 1000011218
        itemSku:
          description: Product SKU
          type: string
          example: 1234XYZ
        offerId:
          description: Offer ID
          type: number
          example: 371922
        offers:
          type: array
          description: Offers
          maxItems: 10
          minItems: 1
          items:
            type: object
            description: Item in Offer
            properties:
              kind:
                description: Pricekind Id
                type: number
                example: 12
              channel:
                description: Channel Id
                type: number
                example: 12
              startDate:
                description: Price start date time
                type: string
                format: date-time
                example: '2021-12-30T02:05:00.000Z'
              endDate:
                description: Price end date time
                type: string
                format: date-time
                example: '2099-12-31T00:00:00.000Z'
              price:
                type: object
                description: Price
                properties:
                  base:
                    description: base price of item
                    type: number
                    example: 2000
                  sale:
                    description: sale price of item if any
                    type: number
                    example: 1000
                  cost:
                    description: Cost of Product
                    type: number
                    example: 800
                  currency:
                    description: Currency
                    type: string
                    example: USD
        createdAt:
          type: string
          description: Date and time of creation
          format: date-time
          example: '2021-10-18T23:19:44.852Z'
        updatedAt:
          type: string
          description: Date and time of updated
          format: date-time
          example: '2021-10-19T00:40:30.341Z'
        job:
          description: Job
          type: boolean
    getItemPriceRequest:
      type: object
      description: Item Price Request Object
      properties:
        itemIds:
          description: Comma seperated list of ItemIds
          type: array
          items:
            type: number
            description: Items
            example: 1000000038
        priceListId:
          description: Price List ID
          type: number
          example: 100000
      required:
        - itemIds
    getItemPriceByListRequest:
      type: object
      description: Price by List
      properties:
        items:
          type: array
          description: Items
          minItems: 1
          items:
            type: object
            description: Items
            required:
              - itemId
              - priceListId
            properties:
              itemId:
                description: Item ID
                type: number
                example: 1000000038
              quantity:
                description: Quantity
                type: number
                example: 10
              priceListId:
                description: Price List ID
                oneOf:
                  - type: number
                    description: price list id
                    example: 100000
                  - type: string
                    description: price list name
                    example: test
      required:
        - items
    createPriceWithMinQuantity:
      type: array
      items:
        type: object
        properties:
          priceListId:
            description: >-
              Pricelist Id or name. this is `optional`. Price will be updated
              for Default Pricelist if priceListId is not provided.
            oneOf:
              - type: number
                description: price list id
                example: 100000
              - type: string
                description: price list name
                example: test
          itemId:
            type: number
            description: Item ID
            example: 1000011218
          itemSku:
            type: string
            description: SKU
            example: 1234XYZ
          offers:
            type: array
            description: Offers
            maxItems: 10
            minItems: 1
            items:
              type: object
              description: Items
              properties:
                kind:
                  description: Pricekind Id
                  type: number
                  example: 0
                channel:
                  description: Channel Id
                  type: number
                  example: 12
                startDate:
                  description: Price start date time
                  type: string
                  format: date-time
                  example: '2021-12-30T02:05:47.234Z'
                endDate:
                  description: Price end date time
                  type: string
                  format: date-time
                  example: '2099-12-31T00:00:00.000Z'
                range:
                  type: array
                  description: Range Prices
                  minItems: 1
                  items:
                    type: object
                    description: Items
                    properties:
                      minQuantity:
                        description: Minimum Quantity
                        type: number
                        example: 2
                      price:
                        description: range price of item
                        type: number
                        example: 500
                price:
                  type: object
                  description: Price
                  properties:
                    base:
                      description: base price of item
                      type: number
                      example: 2000
                    sale:
                      description: sale price of item if any
                      type: number
                      example: ''
                    cost:
                      description: cost of item
                      type: number
                      example: ''
                    currency:
                      description: Currency
                      type: string
                      example: USD
                  required:
                    - base
                    - currency
              required:
                - channel
                - startDate
                - endDate
                - price
        required:
          - priceListId
          - itemId
          - offers
    clientError:
      type: object
      properties:
        code:
          description: The error code, meant for machine consumption.
          type: string
          example: 400
        message:
          description: A human-readable description of the error that occurred.
          type: string
          example: SKU cannot be empty
    serverError:
      type: object
      properties:
        code:
          description: The error code, meant for machine consumption.
          type: string
          example: 500
        message:
          description: A human-readable description of the error that occurred.
          type: string
          example: >-
            An internal error occurred. If the issue persists please contact
            support@fabric.inc.
    bulkInsetResponse:
      type: array
      items:
        type: object
        properties:
          _id:
            description: ID
            type: string
            example: 616e011037a3810008cfb256
          priceListId:
            description: Price List ID
            type: number
            example: 100000
          isSoftDeleted:
            description: Has been soft deleted
            type: boolean
            example: false
          itemId:
            description: Internal Item ID
            type: number
            example: 1000011218
          itemSku:
            description: Produtct SKU
            type: string
            example: 1234XYZ
          offerId:
            description: Offer ID
            type: number
            example: 381933
          offers:
            description: Offers
            type: array
            maxItems: 10
            minItems: 1
            items:
              description: Items
              type: object
              properties:
                kind:
                  description: Pricekind Id
                  type: number
                  example: 0
                channel:
                  description: Channel Id
                  type: number
                  example: 12
                startDate:
                  description: Price start date time
                  type: string
                  format: date-time
                  example: '2021-12-30T02:05:00.000Z'
                endDate:
                  description: Price end date time
                  type: string
                  format: date-time
                  example: '2099-12-31T00:00:00.000Z'
                price:
                  type: object
                  description: Price
                  properties:
                    base:
                      description: base price of item
                      type: number
                      example: 2000
                    sale:
                      description: sale price of item if any
                      type: number
                      example: null
                    cost:
                      description: Cost of product
                      type: number
                      example: ''
                    currency:
                      description: Currency
                      type: string
                      example: USD
                offerCode:
                  type: number
                  description: Offer code
                  example: 123786
                range:
                  type: array
                  description: Price ranges
                  items:
                    type: object
                    description: Items
                    properties:
                      _id:
                        description: ID
                        type: string
                        example: 616e143828d0b800086dd84a
                      minQuantity:
                        description: Min quantity
                        type: number
                        example: 2
                      price:
                        type: number
                        description: Price at min quantity
                        example: 500
          createdAt:
            type: string
            description: Date and time of creation
            format: date-time
            example: '2021-10-18T23:19:44.852Z'
          updatedAt:
            type: string
            description: Date and time of updated
            format: date-time
            example: '2021-10-19T00:40:30.341Z'
          job:
            description: Job
            type: boolean
            example: false
    priceInsertResponse:
      type: object
      description: Create Price Response
      properties:
        _id:
          description: Identifier
          type: string
          example: 616e011037a3810008cfb256
        priceListId:
          description: Price List Identifier
          type: number
          example: 100000
        isSoftDeleted:
          description: Has been soft deleted
          type: boolean
          example: false
        itemId:
          description: Internal Item ID
          type: number
          example: 1000011218
        itemSku:
          description: Product SKU
          type: string
          example: 1234XYZ
        offerId:
          description: Offer ID
          type: number
          example: 371922
        offers:
          type: array
          description: Offers
          maxItems: 10
          minItems: 1
          items:
            type: object
            description: Item in Offer
            properties:
              kind:
                description: Pricekind Id
                type: number
                example: 12
              channel:
                description: Channel Id
                type: number
                example: 12
              startDate:
                description: Price start date time
                type: string
                format: date-time
                example: '2021-12-30T02:05:00.000Z'
              endDate:
                description: Price end date time
                type: string
                format: date-time
                example: '2099-12-31T00:00:00.000Z'
              price:
                type: object
                description: Price
                properties:
                  base:
                    description: base price of item
                    type: number
                    example: 2000
                  sale:
                    description: sale price of item if any
                    type: number
                    example: 1000
                  cost:
                    description: Cost of Product
                    type: number
                    example: 800
                  currency:
                    description: Currency
                    type: string
                    example: USD
              range:
                type: array
                description: Price ranges
                items:
                  type: object
                  description: Items
                  properties:
                    _id:
                      description: ID
                      type: string
                      example: 616e143828d0b800086dd84a
                    minQuantity:
                      description: Min quantity
                      type: number
                      example: 2
                    price:
                      type: number
                      description: Price at min quantity
                      example: 500
        createdAt:
          type: string
          description: Date and time of creation
          format: date-time
          example: '2021-10-18T23:19:44.852Z'
        updatedAt:
          type: string
          description: Date and time of updated
          format: date-time
          example: '2021-10-19T00:40:30.341Z'
        job:
          description: Job
          type: boolean
          example: false
    validate-promo:
      type: object
      required:
        - items
      properties:
        isLoggedIn:
          type: boolean
          description: '`True` indicates a logged in user and `False` indicates guest user.'
          example: false
        userId:
          type: string
          description: >-
            The 24 character system-generated ID of the logged-in user. This is
            auto-generated based on the Authorization Token (JWT token from the
            Login API) specified in the Headers.
          example: 5e2cfb9b45570b000864c4b5
        promoCodes:
          description: The coupon codes applied by the user.
          example:
            - 300DOFF
          type: array
          items:
            type: string
        items:
          description: The item details. At least one item must be specified.
          type: array
          items:
            $ref: '#/components/schemas/items'
    price:
      type: object
      properties:
        base:
          type: number
          description: The base price.
          example: 1000
        sale:
          type: number
          description: The sale price.
          example: 0
        currency:
          type: string
          description: The three character unit of currency.
          example: USD
    items:
      type: object
      required:
        - itemId
        - group
        - quantity
        - price
      properties:
        lineItemId:
          type: number
          description: The number corresponding to the item in the cart.
          example: 1
        sku:
          type: string
          description: >-
            The Stock Keeping Unit (SKU) ID of the item to track in the
            inventory.
          example: SKU0001
        itemId:
          type: number
          description: The unique ID of the item.
          example: 1000000119
        group:
          description: The ID of the group to which the item belongs.
          example:
            - 5e2cfb9b45570b000863c4b5
          type: array
          items:
            type: string
        quantity:
          type: number
          description: The quantity of the item in the cart.
          example: 3
        price:
          description: The price details of the item.
          $ref: '#/components/schemas/price'
    cart-validation:
      type: object
      properties:
        isSuccess:
          type: boolean
          description: >-
            True indicates the cart validation is successful and false indicates
            otherwise.
          example: true
        items:
          description: The item details.
          type: array
          items:
            $ref: '#/components/schemas/items-response'
        appliedDiscounts:
          description: >-
            The basic details (such as promoId, promoTitle, and type) of all the
            discounts applied to the cart.
          type: array
          items:
            $ref: '#/components/schemas/applied-discounts'
        discounts:
          description: >-
            The additional attributes of the discounts applied to the cart such
            as discount ID, unit, and value of discount, along with the basic
            details.
          type: array
          items:
            $ref: '#/components/schemas/discounts'
    price-details:
      type: object
      properties:
        sale:
          type: number
          description: The sale price.
          example: 1000
        cost:
          type: string
          description: The cost of the item as provided by the merchant.
          example: 0
        currency:
          type: string
          description: The three character unit of currency.
          example: USD
        base:
          type: number
          description: The base price.
          example: 5000
        kind:
          type: string
          description: The price type currently active.
          example: Promotion
          enum:
            - Clearance
            - Promotion
        discount:
          type: number
          description: The discount value.
          example: 0
    'ON':
      type: object
      properties:
        kind:
          type: string
          description: The kind or type to which the promotion is applied.
          example: SKU
          enum:
            - SKU
            - CATEGORY
            - ATTRIBUTE
        value:
          type: string
          description: The value of promotion.
          example: null
    discount:
      type: object
      properties:
        _id:
          type: string
          description: The system-generated ID (for internal use only).
          example: 5f9be340dde1cd0008f96035
        unit:
          type: string
          description: >-
            The unit of discount. Represents whether the discount is in
            percentage or dollar value.
          example: AMOUNT_OFF
          enum:
            - '%OFF'
            - AMOUNT_OFF
        value:
          type: number
          description: The discount value.
          example: 300
        'ON':
          description: >-
            For internal use only. Represents the promotion type (SKU, CART, or
            QUANTITY) that was applied.
          $ref: '#/components/schemas/ON'
        id:
          type: string
          description: The ID of the discount.
          example: 5f9be340dde1cd0008f96035
        promoId:
          type: string
          description: The 24 character system-generated ID for a set of promotion codes.
          example: 5f9be340dde1cd0008f96034
        promoCode:
          type: string
          description: The promo code (for customer use).
          example: 300DOFF
        promoTitle:
          type: string
          description: The title of the promotions.
          example: SKU 300 D off all skus
        type:
          type: string
          description: The type of promotions.
          example: COUPON
          enum:
            - PROMOTION-SKU
            - PROMOTION-SHIPPING
            - PROMOTION-CART
            - PROMOTION-QUANTITY
            - COUPON
    items-response:
      type: object
      properties:
        lineItemId:
          type: number
          description: The number corresponding to the item in the cart.
          example: 1
        sku:
          type: string
          description: >-
            The Stock Keeping Unit (SKU) ID of the item to track in the
            inventory.
          example: SKU0001
        itemId:
          type: number
          description: The unique ID of the item.
          example: 1000000119
        group:
          description: The ID of the group to which the item belongs.
          example:
            - 5e2cfb9b45570b000863c4b5
          type: array
          items:
            type: string
        quantity:
          type: number
          description: The quantity of items.
          example: 3
        price:
          description: The price details
          $ref: '#/components/schemas/price-details'
        discount:
          description: The details of the discount applied.
          type: array
          items:
            $ref: '#/components/schemas/discount'
        discountQuantity:
          type: number
          description: The discount quantity.
          example: 3
        discountAmount:
          type: number
          description: The discount value.
          example: 5070
    applied-discounts:
      type: object
      properties:
        promoId:
          type: string
          description: The 24 character system-generated ID for a set of promotion codes.
          example: 5faaac2dd49ffe00071e4f8d
        promoTitle:
          type: string
          description: The name or label of the promo.
          example: 'inclsion promo 99 P off '
        type:
          type: string
          description: The type of promotion.
          example: PROMOTION-SKU
          enum:
            - PROMOTION-SKU
            - PROMOTION-SHIPPING
            - PROMOTION-CART
            - PROMOTION-QUANTITY
            - COUPON
    discounts:
      type: object
      properties:
        _id:
          type: string
          description: The 24-character system-generated ID of the discount.
          example: 5faaac2dd49ffe00071e4f8e
        unit:
          type: string
          description: >-
            The unit of discount. Represents whether the discount is in
            percentage or dollar value.
          example: '%OFF'
          enum:
            - '%OFF'
            - AMOUNT_OFF
        value:
          type: number
          description: The discount value.
          example: 99
        'ON':
          description: >-
            For internal use only. Represents the promotion type (SKU, CART, or
            QUANTITY) that was applied.
          $ref: '#/components/schemas/ON'
        id:
          type: string
          description: The 24 character system-generated discount ID.
          example: 5faaac2dd49ffe00071e4f8e
        type:
          type: string
          description: The type or kind of promotion.
          example: PROMOTION-SKU
          enum:
            - PROMOTION-SKU
            - PROMOTION-SHIPPING
            - PROMOTION-CART
            - PROMOTION-QUANTITY
            - COUPON
        promoId:
          type: string
          description: The system-generated ID for a set of promotion codes.
          example: 5faaac2dd49ffe00071e4f8d
        promoTitle:
          type: string
          description: The name or label of the promo.
          example: inclsion promo 99 P off.
    promo-list:
      type: object
      properties:
        query:
          description: >-
            The query details such as how many promotions must be displayed in a
            page, the offset value, and the total number of applicable
            promotions.
          $ref: '#/components/schemas/query'
        promos:
          description: The details of the promotions.
          type: array
          items:
            $ref: '#/components/schemas/promos'
    promo-limits:
      type: object
      properties:
        _id:
          description: The system-generated ID (for internal use only).
          type: string
          example: 603eae614b40770007494683
        kind:
          description: >-
            Represents coupon or promo limitation per customer and/or across the
            site (for all customers).
          type: string
          example: PER_USER
        value:
          description: The value set for the limit.
          type: number
          example: 4
        id:
          description: The reference ID of the limit (for internal use only).
          type: string
          example: 603eae614b40770007494683
    query:
      type: object
      properties:
        limit:
          type: number
          description: Number of records returned on a single page. Default value is `10`.
          example: 10
        offset:
          description: >-
            Number of records skipped before selecting records. Default value is
            `0`
          example: 0
        count:
          type: number
          description: Total number of promotions in the response
          example: 66
    target-products:
      type: object
      properties:
        kind:
          type: string
          description: Represents the type or kind of target products.
          example: SKU
          enum:
            - SKU
            - CATEGORY
            - ATTRIBUTE
        value:
          type: string
          description: >-
            Represents the target product for which offer must be applied as per
            the selected operator and kind.
          example: '*'
        operator:
          type: string
          description: Represents the supported operations on the targer product.
          example: IN
          enum:
            - NOT_IN
            - IN
            - EQUAL
    promo:
      type: object
      properties:
        condition:
          description: The condition ID (for internal use only).
          example:
            - 5fc8aedcdf91700008c62917
          type: array
          items:
            type: string
        discount:
          description: The details of the applicable discount.
          type: array
          items:
            $ref: '#/components/schemas/discount'
        targetProducts:
          description: >-
            Represents the type or kind of target products, to run the
            promotions.
          type: array
          items:
            $ref: '#/components/schemas/target-products'
    selected-skus:
      description: For internal use only.
      type: object
      properties: {}
    selected-categories:
      description: For internal use only.
      type: object
      properties: {}
    products:
      description: For internal use only.
      type: object
      properties: {}
    selected-attributes-tree:
      description: For internal use only.
      type: object
      properties: {}
    selected-attributes:
      description: For internal use only.
      type: object
      properties: {}
    target-x:
      type: object
      properties:
        selectedSkus:
          description: For internal use only.
          $ref: '#/components/schemas/selected-skus'
        selectedCategories:
          description: For internal use only.
          $ref: '#/components/schemas/selected-categories'
        products:
          description: For internal use only.
          $ref: '#/components/schemas/products'
        radioId:
          type: string
          description: For internal use only.
          example: ALL_PRODUCTS
        skusCount:
          type: number
          description: For internal use only.
          example: 0
        selectedAttributesTree:
          description: For internal use only.
          $ref: '#/components/schemas/selected-attributes-tree'
        selectedAttributes:
          description: For internal use only.
          $ref: '#/components/schemas/selected-attributes'
        totalProductsCount:
          type: number
          description: For internal use only.
          example: 0
        categoriesSkusCount:
          type: string
          description: For internal use only.
          example: 0
    types:
      type: object
      properties:
        targetX:
          description: For internal use only.
          $ref: '#/components/schemas/target-x'
    extra:
      type: object
      description: It stores data related to Front end
      example: {}
    terms-and-conditions:
      type: object
      properties:
        _id:
          type: string
          description: >-
            The system-generated ID for the terms and conditions (for internal
            use only).
          example: 5fc8ad76969f071ff85221e4
        title:
          type: string
          description: The title of the terms and condition.
          example: Entering a Coupon
        description:
          type: string
          description: The description of the terms and condition.
          example: >-
            Each coupon is identified by a code and has different rewards. The
            claimant can decide the reward desired during the booking phase
            whilst being bound by the conditions linked to the redemption of the
            coupon.
    promos:
      type: object
      properties:
        _id:
          type: string
          description: fabric internal unique ID
          example: abcdefg1ee7ce20123456789
        promoId:
          type: number
          description: System generated unique ID of promotion
          example: 100013
        promoCodes:
          type: array
          description: >-
            Returns an empty array for a promotion but will contain promo codes
            for a coupon
          example: []
          items:
            type: string
        promoCount:
          type: number
          description: >-
            Number of promo codes attached to a coupon. It'll be `0` for a
            promotion.
          example: 0
        state:
          type: string
          description: Promotion status
          enum:
            - ACTIVE
            - SCHEDULED
            - DISABLED
            - EXPIRED
          example: SCHEDULED
        isImplicit:
          type: boolean
          description: Returned `true` for a promotion and false for a coupon
          example: true
        title:
          type: string
          description: Title of the promotion
          example: CREATE PROMO
        startDate:
          type: string
          format: date-time
          description: Start date of the promotion
          example: '2019-08-24T14:15:22Z'
        endDate:
          type: string
          format: date-time
          description: End date of the promotion
          example: '2019-08-25T14:15:22Z'
        isExclusive:
          type: boolean
          description: >-
            true: coupon cannot be stacked on promotion<br /> false: coupon can
            be stacked on promotion
          example: true
        eligiblePriceList:
          type: array
          description: Price lists to be considered for this promotion
          items:
            type: number
            example: 10000056
        updatedAt:
          type: string
          format: date-time
          description: Last updated date of the record
          example: '2019-08-20T14:15:22Z'
    promo-single:
      type: object
      properties:
        _id:
          type: string
          description: The 24 character system-generated ID (for internal use only).
          example: 5ff58d31358319306ac05349
        promoCodes:
          description: The promotional codes.
          example:
            - updatePromoCode
          type: array
          items:
            type: string
        state:
          type: string
          description: The state of the promotion.
          example: ACTIVE
          enum:
            - SCHEDULED
            - ACTIVE
            - DISABLED
            - EXPIRED
        isImplicit:
          type: boolean
          description: >-
            `True` indicates that the promo is a coupon and `False` indicates
            promotion.
          example: false
        isExclusive:
          type: boolean
          description: >-
            `True` indicates that coupon is non-stackable and `False` indicates
            stackable.
          example: false
        title:
          type: string
          description: The title of the promotion.
          example: HURRY
        startDate:
          type: string
          description: The promotion start date and time, in ISO format.
          example: '2020-12-03T09:30:00.965Z'
        endDate:
          type: string
          description: The promotion end date and time, in ISO format.
          example: '2020-12-03T18:30:00.000Z'
        type:
          type: string
          description: The type or kind to which the promotion is applied.
          example: PRODUCT
        promo:
          description: The details of the promotions.
          type: array
          items:
            $ref: '#/components/schemas/promo'
        extra:
          description: For internal use only.
          $ref: '#/components/schemas/extra'
        limits:
          description: >-
            The coupon or promo limitations. For example, limit can be set for
            the coupon to be used only 4 times per user and 10 times in total
            across all customer.
          $ref: '#/components/schemas/promo-limits'
        promoId:
          type: number
          description: >-
            The human-readable ID for a set of promotion codes, for external
            use.
          example: 1422
        termsAndConditions:
          description: The terms and conditions of the promotion.
          $ref: '#/components/schemas/terms-and-conditions'
        createdAt:
          type: string
          description: The time stamp of promo creation, in ISO format.
          example: '2021-01-06T10:13:05.169Z'
        updatedAt:
          type: string
          description: The time stamp of promo update, in ISO format.
          example: '2021-01-06T10:36:41.038Z'
        __v:
          type: number
          description: The internal version of the record.
          example: 0
    conditions:
      type: object
      properties:
        value:
          type: string
          description: >-
            The values corresponding to the key. For example, for the key 'SKU'
            the value is a comma-separated list of items and for the key
            'category' the value is a comma-separated list of eligible category
            IDs.
          example: '*'
        operator:
          type: string
          description: Represents how the list of conditions are applied.
          example: IN
          enum:
            - NOT_EQUAL
            - EQUAL
            - GREATER_THAN
            - LESS_THAN
            - GREATER_THAN_OR_EQUAL_TO
            - LESS_THAN_OR_EQUAL_TO
            - NOT_IN
            - IN
        key:
          type: string
          description: >-
            Represents the promotional entity. When promo is specific to SKUs,
            the key is SKU. Likewise, when the promo is specific to quantity
            (promotions such as buy one and get one free), the key is quantity.
          example: SKU
          enum:
            - SKU
            - QUANTITY
            - CATEGORY
            - ATTRIBUTE
            - ORDER_VALUE
            - USER_KIND
        id:
          type: string
          description: For internal use only.
          example: null
    condition:
      type: object
      properties:
        _id:
          type: string
          description: The system-generated ID (for internal use only).
          example: 5ff58d30358319306ac05348
        operator:
          type: string
          description: The operator determines how the list of conditions are applied.
          example: AND
          enum:
            - AND
            - OR
        conditions:
          description: >-
            The list of conditions that must be met for the promotions to
            eligible on the cart.
          type: array
          items:
            $ref: '#/components/schemas/conditions'
        createdAt:
          type: string
          description: The date and time of conditions (for promo) creation, in ISO format.
          example: '2021-01-06T10:13:04.426Z'
        updatedAt:
          type: string
          description: The date and time of conditions (for promo) update, in ISO format.
          example: '2021-01-06T10:36:40.787Z'
        __v:
          type: number
          description: The internal version of the record.
          example: 0
    price-cost:
      type: object
      properties:
        sale:
          type: number
          description: The sale price.
          example: 800
        cost:
          type: number
          description: The cost of the item as provided by the merchant.
          example: 0
        currency:
          type: string
          description: Three character unit of currency
          example: USD
        base:
          type: number
          description: Base price
          example: 1000
    offers:
      type: object
      properties:
        price:
          type: object
          items:
            $ref: '#/components/schemas/price-cost'
        _id:
          type: string
          description: System-generated ID (for internal use only)
          example: 5ff4536a44473d0007d49742
        kind:
          type: string
          description: Kind or type of offer
          example: Clearance
        channel:
          type: number
          description: Sales channel
          example: 12
        startDate:
          type: string
          description: Start date of the offer, in ISO format
          example: '2021-01-05T18:30:00.000Z'
        endDate:
          type: string
          description: End date of the offer, in ISO format
          example: '2099-12-31T18:29:00.000Z'
        offerCode:
          type: number
          description: Offer code
          example: 113074
