openapi: 3.0.1
info:
  title: Common Entities - Cart
  description: Common Cart domain entities
  version: 3.0.0
  x-audience: external-public
  contact:
    name: Cart Support
    email: support.cnc@fabric.inc
  license:
    name: fabric API License
    url: https://fabric.inc/api-license
  termsOfService: https://fabric.inc/terms-of-use
servers:
  - url: https://api.fabric.inc/v3
    description: Production
tags:
  - name: Carts
    description: >-
      Carts endpoints let you perform basic cart operations, including finding,
      creating, updating, and merging carts. You can also apply or remove a
      promotion code to or from a cart.
  - name: Line Items
    description: >-
      Line Items endpoints let you perform basic line item operations, including
      creating, updating, and deleting line items in a cart. You can also get
      and update line item attributes and shipping details.
paths: {}
components:
  schemas:
    itemId:
      type: integer
      description: Item ID obtained from Product Catalog.
      format: int32
      example: 1730902008
    calculatedPriceObject:
      type: object
      description: Calculated price details of line items
      example:
        sale: 1000.15
        cost: 900.15
        base: 2000.15
        unitPriceWithoutDiscounts: 2000.15
        lineTotalWithoutDiscounts: 2000.15
        lineTotalWithDiscounts: 2000.15
        type: BASE
      properties:
        sale:
          type: number
          description: Price at which the product is offered for sale
          format: double
          example: 1000.15
          nullable: true
        cost:
          type: number
          description: >-
            Cost of goods sold, from either producing or purchasing from other
            vendors
          format: double
          example: 900.15
        base:
          type: number
          description: Starting price of a single item
          format: double
          example: 2000.15
        unitPriceWithoutDiscounts:
          type: number
          nullable: true
          description: >-
            Price of a single item without discount. This price is either the
            `base` or `sale` price. The type used is noted in the `type`
            property.
          format: double
          example: 2000.15
        lineTotalWithoutDiscounts:
          type: number
          nullable: true
          description: >-
            Total price of all items without calculating discounts. This is the
            `unitPriceWithoutDiscounts` multiplied by the quantity.
          format: double
          example: 5000.15
        lineTotalWithDiscounts:
          type: number
          nullable: true
          description: >-
            Total price of all items after all discounts. This is the
            unitPriceWithoutDiscounts multiplied by the quantity, less the
            promotion discount(s).
          format: double
          example: 5000.15
        type:
          type: string
          nullable: true
          description: Price type
          example: BASE
        currency:
          type: string
          description: Currency string value
          example: USD
    lineItemReference:
      description: Line item details
      required:
        - quantity
        - itemId
      type: object
      properties:
        itemId:
          $ref: '#/components/schemas/itemId'
        position:
          minimum: 1
          type: integer
          description: Line item position (starts at 1)
          format: int32
          example: 1
        sku:
          type: string
          description: Line item SKU
          example: 16B2GS8LD5FDS
        productAttributes:
          description: Line item product attributes
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/productAttribute'
        quantity:
          type: integer
          format: int32
          description: Line item quantity within the cart
          example: 15
        priceListId:
          type: integer
          format: int32
          description: The price list ID of the line item.
          nullable: true
          example: 108674
        price:
          description: Individual line item price
          allOf:
            - $ref: '#/components/schemas/calculatedPriceObject'
            - nullable: true
        groups:
          type: array
          description: List of group IDs for groups or category the line items belongs to
          nullable: true
          items:
            type: string
            description: ID of group or category to which line item belongs
            example: 61d38e117162b7dba69c3d6d
        attributes:
          type: object
          additionalProperties: true
          description: Line item attributes passed by caller
          nullable: true
          example:
            productFamily: Laptop computers
        shippingDetails:
          description: Shipping details
          allOf:
            - $ref: '#/components/schemas/shippingDetailReference'
            - nullable: true
    shippingDetailReference:
      description: Shipping details reference
      type: object
      properties:
        shippingCost:
          type: number
          format: double
          description: Shipping cost
          example: 150.25
        shippingMethodId:
          type: string
          description: Shipping method ID
          example: dfsae-2d32113-32lpdd
        shippingDiscount:
          type: number
          format: double
          description: Discount amount
          example: 150.25
        shippingMethodName:
          type: string
          description: Shipping method name
          nullable: true
          example: Express Delivery
    productAttribute:
      description: Product attribute as defined within Product Catalog.
      required:
        - value
        - name
      type: object
      properties:
        attributeId:
          type: string
          description: Attribute ID
          example: 60c2a358eb2ec30008ae70a1
        name:
          type: string
          description: Attribute name
          example: gift wrapping (small)
        description:
          type: string
          description: Attribute description
          nullable: true
          example: Gift wrapping for a small package
        mapping:
          type: string
          description: Attribute mapping
          nullable: true
          example: ITEM
        type:
          type: string
          description: Attribute type
          example: GIFT
          nullable: true
        value:
          type: string
          description: Attribute value
          nullable: true
          example: 'true'
        price:
          type: number
          format: double
          nullable: true
          description: Attribute price
          example: 10
        level:
          type: string
          description: Attribute level
          nullable: true
          example: order
