{
  "$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-request-schema.json",
  "title": "PromotionCampaignAssignmentRequest",
  "description": "Request body for creating or replacing a promotion campaign assignment (PUT). Omits the read-only nested\ncampaign and promotion courtesy copies, which are response-only.",
  "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/PromotionCampaignAssignmentRequest",
  "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": {
      "minLength": 1,
      "maxLength": 256,
      "description": "The ID of the campaign. If supplied, must equal the campaignId path parameter.",
      "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"
    },
    "promotionId": {
      "minLength": 1,
      "maxLength": 256,
      "description": "The ID of the promotion. If supplied, must equal the promotionId path parameter.",
      "type": "string"
    },
    "rank": {
      "format": "int32",
      "description": "The rank of the promotion campaign assignment. Must be null or a multiple of 10\nfrom 0 to 100 (0, 10, 20, ..., 100).",
      "type": "integer",
      "minimum": 0,
      "maximum": 100,
      "multipleOf": 10
    },
    "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": [
    "schedule"
  ],
  "$defs": {
    "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])?$"
        }
      }
    }
  }
}