{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/salesforce-commerce-cloud/json-schema/salesforce-commerce-cloud-oms-status-event-request-schema.json",
  "title": "OmsStatusEventRequest",
  "description": "A single OMS-originated status event for an order. Exactly one of fulfillmentEvent or\nadjustment must be present.\n",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/salesforce-commerce-cloud-orders-api-openapi.yml#/components/schemas/OmsStatusEventRequest",
  "additionalProperties": false,
  "properties": {
    "omsOrderId": {
      "minLength": 1,
      "maxLength": 256,
      "description": "Optional external OMS identifier. Echoed back in forwarded order event payloads.",
      "type": "string"
    },
    "fulfillmentEvent": {
      "$ref": "#/$defs/OmsFulfillmentEvent"
    },
    "adjustment": {
      "$ref": "#/$defs/OmsAdjustment"
    }
  },
  "type": "object",
  "oneOf": [
    {
      "required": [
        "fulfillmentEvent"
      ]
    },
    {
      "required": [
        "adjustment"
      ]
    }
  ],
  "$defs": {
    "OmsAdjustment": {
      "description": "A post-order adjustment reported by an external OMS (for example, refund, return, cancellation).",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "type": {
          "description": "Adjustment type (open string, for example, refund, return, credit, cancellation).",
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "occurredAt": {
          "type": "string",
          "format": "date-time"
        },
        "status": {
          "type": "string",
          "enum": [
            "pending",
            "completed",
            "failed"
          ]
        },
        "lineItems": {
          "type": "array",
          "maxItems": 200,
          "items": {
            "$ref": "#/$defs/OmsAdjustmentLineItem"
          }
        },
        "totals": {
          "type": "array",
          "maxItems": 200,
          "items": {
            "$ref": "#/$defs/OmsAdjustmentTotal"
          }
        },
        "description": {
          "description": "Free-form note about the adjustment provided by the OMS. Shown to support agents and forwarded to order event subscribers.",
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      },
      "type": "object",
      "required": [
        "id",
        "type",
        "occurredAt",
        "status"
      ]
    },
    "OmsAdjustmentLineItem": {
      "description": "A reference to an order line item affected by an adjustment, with a signed quantity (negative for reductions/returns).",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "quantity": {
          "description": "Signed quantity; negative for reductions or returns.",
          "type": "integer"
        }
      },
      "type": "object",
      "required": [
        "id",
        "quantity"
      ]
    },
    "OmsAdjustmentTotal": {
      "description": "A signed monetary total for an adjustment, broken down by cost category, in minor currency units (for example, cents for EUR or USD; decimal places follow the order's currency).",
      "additionalProperties": false,
      "properties": {
        "type": {
          "description": "Cost category. Well-known values: subtotal, items_discount, discount, fulfillment, tax, fee, total. Additional values are permitted.",
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "amount": {
          "description": "Signed amount in minor currency units (for example, cents for EUR or USD); the number of decimal places follows the order's currency. Negative for money returned to the buyer.",
          "type": "integer"
        },
        "displayText": {
          "description": "Text describing the adjustment total for display.",
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      },
      "type": "object",
      "required": [
        "type",
        "amount"
      ]
    },
    "OmsFulfillmentEvent": {
      "description": "A fulfillment event reported by an external OMS (for example, shipped, delivered, canceled).",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "occurredAt": {
          "description": "RFC 3339 timestamp when the event occurred.",
          "type": "string",
          "format": "date-time"
        },
        "type": {
          "description": "Fulfillment event type. Common values: processing, shipped, in_transit, delivered, failed_attempt, canceled, undeliverable, returned_to_sender. Additional values are permitted.",
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "lineItems": {
          "type": "array",
          "minItems": 1,
          "maxItems": 200,
          "items": {
            "$ref": "#/$defs/OmsLineItemReference"
          }
        },
        "trackingNumber": {
          "description": "Required when type is not \"processing\". Otherwise, a 400 Bad Request is returned.",
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "trackingUrl": {
          "description": "Required when type is not \"processing\". Otherwise, a 400 Bad Request is returned.",
          "type": "string",
          "format": "uri",
          "minLength": 1,
          "maxLength": 2048
        },
        "carrier": {
          "description": "The carrier handling the shipment (for example, UPS, FedEx, DHL).",
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "description": {
          "description": "Free-form note about the event provided by the OMS. Shown to support agents and forwarded to order event subscribers.",
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        }
      },
      "type": "object",
      "required": [
        "id",
        "occurredAt",
        "type",
        "lineItems"
      ]
    },
    "OmsLineItemReference": {
      "description": "A reference to an order line item affected by a fulfillment event, with the fulfilled quantity.",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 256
        },
        "quantity": {
          "description": "Fulfillment line-item quantity. Zero is allowed.",
          "type": "integer",
          "minimum": 0
        }
      },
      "type": "object",
      "required": [
        "id",
        "quantity"
      ]
    }
  }
}