{
  "$defs": {
    "CampaignAdmission": {
      "description": "Campaign admission model.",
      "enum": [
        "open",
        "application",
        "invite-only",
        "vouching",
        "selective"
      ],
      "type": "string"
    },
    "CampaignBudget": {
      "description": "Campaign budget.",
      "properties": {
        "cost_per_acquisition": {
          "description": "Target (or achieved) cost per acquisition in `currency`. Canonical\nname for what is sometimes written as `cpa`; always use\n`cost_per_acquisition` in YAML.",
          "format": "double",
          "minimum": 0.0,
          "type": [
            "number",
            "null"
          ]
        },
        "currency": {
          "$ref": "#/$defs/IsoCurrency",
          "description": "ISO 4217 currency for all budget fields on this struct."
        },
        "description": {
          "description": "Free-form budget notes (assumptions, derivation, cohort-size effects).",
          "type": [
            "string",
            "null"
          ]
        },
        "monthly": {
          "description": "Monthly run-rate spend, in `currency`.",
          "format": "double",
          "minimum": 0.0,
          "type": [
            "number",
            "null"
          ]
        },
        "total": {
          "description": "Total campaign budget over its lifetime, in `currency`.",
          "format": "double",
          "minimum": 0.0,
          "type": [
            "number",
            "null"
          ]
        }
      },
      "required": [
        "currency"
      ],
      "type": "object"
    },
    "CampaignCustom": {
      "description": "Typed custom extension data for `Campaign`.",
      "properties": {
        "brand_effect": {
          "type": [
            "string",
            "null"
          ]
        },
        "cohort_geography": {
          "type": [
            "string",
            "null"
          ]
        },
        "cohort_size": {
          "format": "int64",
          "type": [
            "integer",
            "null"
          ]
        },
        "conversion_target": {
          "format": "double",
          "type": [
            "number",
            "null"
          ]
        },
        "dual_pricing_note": {
          "type": [
            "string",
            "null"
          ]
        },
        "mechanics": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "CampaignEligibility": {
      "description": "Campaign eligibility criteria.",
      "properties": {
        "admission": {
          "anyOf": [
            {
              "$ref": "#/$defs/CampaignAdmission"
            },
            {
              "type": "null"
            }
          ]
        },
        "capacity": {
          "format": "int64",
          "minimum": 0,
          "type": [
            "integer",
            "null"
          ]
        },
        "criteria": {
          "default": [],
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "CampaignStatus": {
      "description": "Campaign status lifecycle.",
      "enum": [
        "planned",
        "active",
        "paused",
        "completed",
        "cancelled"
      ],
      "type": "string"
    },
    "CampaignType": {
      "description": "Campaign type discriminator.",
      "enum": [
        "brand-building",
        "acquisition",
        "retention",
        "engagement",
        "product"
      ],
      "type": "string"
    },
    "IsoCurrency": {
      "description": "ISO 4217 currency code.",
      "pattern": "^[A-Z]{3}$",
      "type": "string"
    },
    "IsoDate": {
      "description": "ISO 8601 date (YYYY-MM-DD).",
      "format": "date",
      "type": "string"
    },
    "PathRef": {
      "description": "Path-based cross-reference relative to .corpospec/ root.\nPattern: `^[a-z0-9_-]+(/[a-z0-9_.-]+)+$`",
      "pattern": "^[a-z0-9_-]+(/[a-z0-9_.-]+)+$",
      "type": "string"
    }
  },
  "$id": "https://corpospec.com/schemas/v0.8.1/campaign.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "Marketing campaign definition.",
  "properties": {
    "budget": {
      "anyOf": [
        {
          "$ref": "#/$defs/CampaignBudget"
        },
        {
          "type": "null"
        }
      ]
    },
    "custom": {
      "anyOf": [
        {
          "$ref": "#/$defs/CampaignCustom"
        },
        {
          "type": "null"
        }
      ]
    },
    "delivery_mechanism": {
      "type": [
        "string",
        "null"
      ]
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "duration_months": {
      "description": "Planned duration in months. Informational; for precise boundaries\nuse `start_date` and `end_date`.",
      "format": "int64",
      "minimum": 0,
      "type": [
        "integer",
        "null"
      ]
    },
    "eligibility": {
      "anyOf": [
        {
          "$ref": "#/$defs/CampaignEligibility"
        },
        {
          "type": "null"
        }
      ]
    },
    "end_date": {
      "anyOf": [
        {
          "$ref": "#/$defs/IsoDate"
        },
        {
          "type": "null"
        }
      ],
      "description": "Campaign end date (ISO 8601, YYYY-MM-DD). Optional; open-ended\ncampaigns (retention, always-on brand) omit this field."
    },
    "id": {
      "$ref": "#/$defs/PathRef"
    },
    "name": {
      "type": "string"
    },
    "objective": {
      "type": [
        "string",
        "null"
      ]
    },
    "related_decisions": {
      "default": [],
      "items": {
        "$ref": "#/$defs/PathRef"
      },
      "type": "array"
    },
    "start_date": {
      "anyOf": [
        {
          "$ref": "#/$defs/IsoDate"
        },
        {
          "type": "null"
        }
      ],
      "description": "Campaign start date (ISO 8601, YYYY-MM-DD). Optional; campaigns in\n`planned` status may omit dates until scheduled."
    },
    "status": {
      "$ref": "#/$defs/CampaignStatus"
    },
    "type": {
      "$ref": "#/$defs/CampaignType"
    }
  },
  "required": [
    "id",
    "name",
    "type",
    "status"
  ],
  "title": "Campaign",
  "type": "object"
}