openapi: 3.1.1
info:
  title: Retail — Core Commitment Attributes (v2.1)
  version: 2.1.0
  description: >
    Per-commitment line-level details for retail contracts.
    NEW in v2.1 — fields extracted from FoodAndBeverageItem v2.
    Attaches to beckn:Commitment via commitmentAttributes.

components:
  schemas:
    RetailCommitment:
      type: object
      x-beckn-container: commitmentAttributes
      x-jsonld:
        "@context": "https://schema.nfh.global/RetailCommitment/v2.1/context.jsonld"
        "@type": "rccma:RetailCommitment"
      required:
        - lineId
        - resourceId
        - quantity
      properties:
        lineId:
          type: string
          description: Line reference identifier within the contract
          x-jsonld-id: "rccma:lineId"
        resourceId:
          type: string
          description: Reference to the Resource being committed
          x-jsonld-id: "rccma:resourceId"
        offerId:
          type: string
          description: Reference to the Offer under which this commitment was made
          x-jsonld-id: "rccma:offerId"
        quantity:
          type: object
          description: Quantity with unit code and unit quantity
          x-jsonld-id: "rccma:quantity"
          required:
            - unitQuantity
            - unitCode
          properties:
            unitCode:
              type: string
              description: Unit of measurement (e.g., EA, KG, L)
              x-jsonld-id: "rccma:unitCode"
            unitQuantity:
              type: number
              minimum: 0
              description: Numeric quantity in the specified unit
              x-jsonld-id: "rccma:unitQuantity"
        price:
          allOf:
            - $ref: "https://schema.nfh.global/PriceSpecification/v2.0/attributes.yaml#/components/schemas/PriceSpecification"
          description: Committed (post-discount) price for this line item
          x-jsonld-id: "rccma:price"
        originalPrice:
          allOf:
            - $ref: "https://schema.nfh.global/PriceSpecification/v2.0/attributes.yaml#/components/schemas/PriceSpecification"
          description: >
            Pre-discount price for display and audit purposes (e.g., strikethrough pricing,
            discount percentage computation, promotional mechanics auditing). Only populate
            when originalPrice differs from price — omit when no discount applies.
          x-jsonld-id: "rccma:originalPrice"
        addOnIds:
          type: array
          description: >
            IDs of add-ons selected by the buyer for this commitment line.
            Add-ons are defined at the Offer layer; this field records which
            were chosen at order time. Per-add-on quantities or prices are
            a L2 concern and can be modelled via extension.
          items:
            type: string
          x-jsonld-id: "rccma:addOnIds"
        selectedCustomizations:
          type: array
          description: >
            Customization options selected by the buyer for this line (e.g., F&B
            size/extras/modifiers, configurable product colour/storage). The combination
            of groupId + optionId must be sufficient to reconstruct the committed item
            without ambiguity. label is a display-only hint — do not use it for routing
            or matching logic.
          items:
            type: object
            required: [groupId, optionId]
            properties:
              groupId:
                type: string
                description: Customization group identifier (e.g., "size", "extras", "colour")
                x-jsonld-id: "rccma:customizationGroupId"
              optionId:
                type: string
                description: Selected option identifier within the group
                x-jsonld-id: "rccma:customizationOptionId"
              label:
                type: string
                description: Human-readable label for display only (e.g., "Large", "Extra Spicy")
                x-jsonld-id: "rccma:customizationLabel"
          x-jsonld-id: "rccma:selectedCustomizations"
        specialInstructions:
          type: string
          description: Per-line buyer notes (e.g., "no onions", "extra spicy")
          x-jsonld-id: "rccma:specialInstructions"
