{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/salesforce-commerce-cloud/json-schema/salesforce-commerce-cloud-promotion-campaign-assignment-schema.json",
  "title": "PromotionCampaignAssignment",
  "description": "Document representing a promotion campaign assignment.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/salesforce-commerce-cloud-campaigns-api-openapi.yml#/components/schemas/PromotionCampaignAssignment",
  "additionalProperties": {
    "title": "Additional Property Support",
    "description": "This type supports additional properties passed along with the defined properties of this API.\nTo indicate that the properties were defined and expected to be handled as additional properties, they are expected to be prefixed with a `c_`.\nThe type will reject any property that does not fit this pattern, only allowing additional properties beginning with the known prefix."
  },
  "properties": {
    "campaign": {
      "description": "The campaign.",
      "allOf": [
        {
          "$ref": "#/$defs/Campaign"
        }
      ]
    },
    "campaignId": {
      "minLength": 1,
      "maxLength": 256,
      "description": "The ID of the campaign.",
      "type": "string"
    },
    "coupons": {
      "description": "The sorted array of assigned coupon IDs.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/CouponId"
      }
    },
    "couponsBased": {
      "$ref": "#/$defs/CouponsBased"
    },
    "customerGroups": {
      "description": "The sorted array of assigned customer groups.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/CustomerGroupId"
      }
    },
    "customerGroupsBased": {
      "$ref": "#/$defs/CustomerGroupsBased"
    },
    "enabled": {
      "description": "Read-only. True if the assigned promotion is enabled. Derived from the promotion's enabled state; cannot be set on the assignment. Use the Promotions API to change it.",
      "type": "boolean",
      "readOnly": true
    },
    "promotionId": {
      "minLength": 1,
      "maxLength": 256,
      "description": "The ID of the promotion. Use the Promotions API to fetch the full promotion.",
      "type": "string"
    },
    "rank": {
      "format": "int32",
      "description": "The rank of promotion campaign assignment.",
      "type": "integer"
    },
    "requiredQualifier": {
      "$ref": "#/$defs/RequiredQualifier"
    },
    "schedule": {
      "description": "The schedule of the assignment resource.",
      "allOf": [
        {
          "$ref": "#/$defs/Schedule"
        }
      ]
    },
    "sourceCodeBased": {
      "$ref": "#/$defs/SourceCodeBased"
    },
    "sourceCodeGroups": {
      "description": "The sorted array of assigned source code groups.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/SourceCodeGroupId"
      }
    }
  },
  "type": "object",
  "required": [
    "campaign",
    "campaignId",
    "coupons",
    "couponsBased",
    "customerGroups",
    "customerGroupsBased",
    "enabled",
    "promotionId",
    "rank",
    "requiredQualifier",
    "schedule",
    "sourceCodeBased",
    "sourceCodeGroups"
  ],
  "$defs": {
    "Campaign": {
      "description": "Document representing a campaign.",
      "additionalProperties": {
        "title": "Additional Property Support",
        "description": "This type supports additional properties passed along with the defined properties of this API.\nTo indicate that the properties were defined and expected to be handled as additional properties, they are expected to be prefixed with a `c_`.\nThe type will reject any property that does not fit this pattern, only allowing additional properties beginning with the known prefix."
      },
      "properties": {
        "campaignId": {
          "$ref": "#/$defs/CampaignId"
        },
        "coupons": {
          "description": "The array of assigned coupon IDs, not sorted.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/CouponId"
          }
        },
        "creationDate": {
          "description": "Returns the value of attribute 'creationDate'.",
          "type": "string",
          "format": "date-time"
        },
        "customerGroups": {
          "description": "The array of assigned customer groups, not sorted.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/CustomerGroupId"
          }
        },
        "description": {
          "maxLength": 4000,
          "description": "The description of the campaign.",
          "type": "string"
        },
        "enabled": {
          "description": "The enabled flag for campaign.",
          "type": "boolean"
        },
        "endDate": {
          "description": "The date the scenario ends.",
          "type": "string",
          "format": "date-time"
        },
        "lastModified": {
          "description": "Returns the value of attribute 'lastModified'.",
          "type": "string",
          "format": "date-time"
        },
        "sourceCodeGroups": {
          "description": "The array of assigned source code groups, not sorted.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/SourceCodeGroupId"
          }
        },
        "startDate": {
          "description": "The date the scenario begins.",
          "type": "string",
          "format": "date-time"
        }
      },
      "type": "object"
    },
    "CampaignId": {
      "minLength": 1,
      "maxLength": 256,
      "description": "The ID of the campaign.",
      "type": "string"
    },
    "CouponId": {
      "minLength": 1,
      "maxLength": 256,
      "description": "The ID of the coupon.",
      "type": "string"
    },
    "CouponsBased": {
      "description": "Whether the coupons qualifier participates in the assignment's qualification rule. When true, the\nassigned coupons gate the promotion (combined with campaign-level coupons). When omitted, defaults to\ntrue if a non-empty coupons array is supplied, otherwise false.",
      "type": "boolean"
    },
    "CustomerGroupId": {
      "minLength": 1,
      "maxLength": 256,
      "description": "The ID of the customer group.",
      "type": "string"
    },
    "CustomerGroupsBased": {
      "description": "Whether the customer-groups qualifier participates in the assignment's qualification rule. When true,\nthe assigned customer groups gate the promotion (combined with campaign-level customer groups). When\nomitted, defaults to true if a non-empty customerGroups array is supplied, otherwise false.",
      "type": "boolean"
    },
    "Recurrence": {
      "type": "object",
      "description": "Document representing a schedule recurrence.",
      "additionalProperties": false,
      "properties": {
        "dayOfWeek": {
          "description": "The days of week for recurrence.",
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "monday",
              "tuesday",
              "wednesday",
              "thursday",
              "friday",
              "saturday",
              "sunday"
            ]
          }
        },
        "timeOfDay": {
          "description": "The time of the day for recurrence.",
          "allOf": [
            {
              "$ref": "#/$defs/TimeOfDay"
            }
          ]
        }
      }
    },
    "RequiredQualifier": {
      "description": "Controls how the active qualifier types (coupons, customer groups, source-code groups) combine.\n'all' requires every active qualifier type to be satisfied (AND); 'any' requires at least one (OR).\nDefaults to 'any' when omitted.",
      "type": "string",
      "enum": [
        "all",
        "any"
      ],
      "default": "any"
    },
    "Schedule": {
      "type": "object",
      "description": "Document representing a time schedule. Defines an optional validity window (startDate/endDate) and an optional recurrence. Omitting a bound leaves that side of the window open (unbounded).",
      "additionalProperties": false,
      "properties": {
        "startDate": {
          "description": "The date to start validity. ISO8601 date time format: yyyy-MM-dd'T'HH:mm:ssZ.",
          "type": "string",
          "format": "date-time"
        },
        "endDate": {
          "description": "The date to end of validity. ISO8601 date time format: yyyy-MM-dd'T'HH:mm:ssZ.",
          "type": "string",
          "format": "date-time"
        },
        "recurrence": {
          "description": "The recurrence of the schedule by day of week and time of day. Not all schedules support a recurrence.",
          "allOf": [
            {
              "$ref": "#/$defs/Recurrence"
            }
          ]
        }
      }
    },
    "SourceCodeBased": {
      "description": "Whether the source-code-groups qualifier participates in the assignment's qualification rule. When true,\nthe assigned source-code groups gate the promotion (combined with campaign-level source-code groups).\nWhen omitted, defaults to true if a non-empty sourceCodeGroups array is supplied, otherwise false.",
      "type": "boolean"
    },
    "SourceCodeGroupId": {
      "minLength": 1,
      "maxLength": 28,
      "description": "The ID of source code group.",
      "type": "string"
    },
    "TimeOfDay": {
      "type": "object",
      "description": "Document representing a time schedule within a single day.",
      "additionalProperties": false,
      "properties": {
        "timeFrom": {
          "description": "The time to start from. Time format: HH:mm or HH:mm:ss. Seconds are ignored and set to 0.",
          "type": "string",
          "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$"
        },
        "timeTo": {
          "description": "The time to end on. Time format: HH:mm or HH:mm:ss. Seconds are ignored and set to 0.",
          "type": "string",
          "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$"
        }
      }
    }
  }
}