{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dream-sports/json-schema/dream-sports-ctaupdate-request-schema.json",
  "title": "CTAUpdateRequest",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dream-sports-ctas-api-openapi.yml#/components/schemas/CTAUpdateRequest",
  "type": "object",
  "properties": {
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "description": {
      "type": "string"
    },
    "team": {
      "type": "string"
    },
    "startTime": {
      "type": "integer",
      "format": "int64"
    },
    "endTime": {
      "type": "integer",
      "format": "int64"
    },
    "rule": {
      "$ref": "#/$defs/RuleRequest"
    }
  },
  "$defs": {
    "CohortEligibility": {
      "type": "object",
      "description": "Cohort eligibility configuration for CTAs. IMPORTANT: User-cohorts system is not currently supported. Always use includes: [\"all\"] (single cohort) or includes: [\"all\"] (list), and keep excludes: [] empty.",
      "required": [
        "includes",
        "excludes"
      ],
      "properties": {
        "includes": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "List of cohort names to include. Must be [\"all\"] since user-cohorts system is not currently supported.",
          "minItems": 1
        },
        "excludes": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "List of cohort names to exclude. Must always be empty [] since user-cohorts system is not currently supported."
        }
      }
    },
    "Filters": {
      "type": "object",
      "required": [
        "operator",
        "filter"
      ],
      "properties": {
        "operator": {
          "type": "string"
        },
        "filter": {
          "type": "array",
          "items": {}
        }
      }
    },
    "Frequency": {
      "type": "object",
      "properties": {
        "session": {
          "$ref": "#/$defs/SessionFrequency"
        },
        "window": {
          "$ref": "#/$defs/WindowFrequency"
        },
        "lifeSpan": {
          "$ref": "#/$defs/LifespanFrequency"
        }
      }
    },
    "GroupByConfig": {
      "type": "object",
      "properties": {
        "maxActiveStateMachineCount": {
          "type": "integer",
          "format": "int32"
        },
        "groupByKeys": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "LifespanFrequency": {
      "type": "object",
      "required": [
        "limit"
      ],
      "properties": {
        "limit": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "RuleRequest": {
      "type": "object",
      "description": "Rule configuration for CTA including cohort eligibility, state transitions, actions, and frequency. Note: cohortEligibility must use includes: [\"all\"] and excludes: [].",
      "required": [
        "cohortEligibility",
        "stateToAction",
        "stateTransition",
        "priority",
        "stateMachineTTL",
        "actions",
        "frequency"
      ],
      "properties": {
        "cohortEligibility": {
          "description": "Cohort eligibility. Must use includes: [\"all\"] and excludes: [] since user-cohorts system is not currently supported.",
          "type": "object",
          "$ref": "#/$defs/CohortEligibility"
        },
        "stateToAction": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "minProperties": 1
        },
        "resetStates": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "resetCTAonFirstLaunch": {
          "type": "boolean"
        },
        "contextParams": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "stateTransition": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/StateTransitionCondition"
              }
            }
          }
        },
        "groupByConfig": {
          "$ref": "#/$defs/GroupByConfig"
        },
        "priority": {
          "type": "integer",
          "format": "int32"
        },
        "stateMachineTTL": {
          "type": "integer",
          "format": "int64"
        },
        "actions": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "frequency": {
          "$ref": "#/$defs/Frequency"
        }
      }
    },
    "SessionFrequency": {
      "type": "object",
      "required": [
        "limit"
      ],
      "properties": {
        "limit": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "StateTransitionCondition": {
      "type": "object",
      "required": [
        "transitionTo",
        "filters"
      ],
      "properties": {
        "transitionTo": {
          "type": "string"
        },
        "filters": {
          "$ref": "#/$defs/Filters"
        }
      }
    },
    "WindowFrequency": {
      "type": "object",
      "required": [
        "limit",
        "unit",
        "value"
      ],
      "properties": {
        "limit": {
          "type": "integer",
          "format": "int32"
        },
        "unit": {
          "$ref": "#/$defs/WindowFrequencyUnit"
        },
        "value": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "WindowFrequencyUnit": {
      "type": "string",
      "enum": [
        "days",
        "hours",
        "minutes",
        "seconds"
      ]
    }
  }
}