{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cm-com/json-schema/cm-com-analytics-report-subscription-schema.json",
  "title": "AnalyticsReportSubscription",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cm-com-analytics-report-subscriptions-api-openapi.yml#/components/schemas/AnalyticsReportSubscription",
  "type": "object",
  "properties": {
    "uuid": {
      "type": "string",
      "maxLength": 36
    },
    "emails": {
      "description": "Recipient email addresses. All addresses share the same computed report per run.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "phoneNumbers": {
      "description": "Recipient phone numbers (E.164) for the WhatsApp channel. Empty for the EMAIL channel.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "filterPresetUuids": {
      "description": "UUIDs of the filter presets whose analytics should be sent.",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "dateRangeOption": {
      "type": "string",
      "enum": [
        "TODAY",
        "WEEK",
        "MONTH",
        "ABSOLUTE"
      ]
    },
    "intervalMinutes": {
      "type": "number",
      "enum": [
        15,
        30,
        60
      ]
    },
    "channel": {
      "type": "string",
      "enum": [
        "EMAIL",
        "WHATSAPP",
        "SMS"
      ]
    },
    "enabled": {
      "type": "boolean"
    },
    "startAt": {
      "format": "date-time",
      "type": "string"
    },
    "expiresAt": {
      "format": "date-time",
      "type": "string",
      "description": "When the subscription auto-disables. Capped at 7 days from startAt."
    },
    "lastRunAt": {
      "type": [
        "object",
        "null"
      ]
    },
    "nextRunAt": {
      "format": "date-time",
      "type": "string"
    }
  },
  "required": [
    "uuid",
    "emails",
    "phoneNumbers",
    "filterPresetUuids",
    "dateRangeOption",
    "intervalMinutes",
    "channel",
    "enabled",
    "startAt",
    "expiresAt",
    "nextRunAt"
  ]
}