{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/thousandeyes/json-schema/thousandeyes-dashboards-api-dashboard-schedule-request-schema.json",
  "title": "Dashboards_API_DashboardScheduleRequest",
  "description": "Snapshot schedule configuration for create or update requests.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/thousandeyes-dashboards-api-openapi.yml#/components/schemas/Dashboards_API_DashboardScheduleRequest",
  "type": "object",
  "required": [
    "cronSpec",
    "dataSource",
    "dataTimespan",
    "flagEnabled"
  ],
  "properties": {
    "cronSpec": {
      "$ref": "#/$defs/Dashboards_API_DashboardScheduleCronSpec"
    },
    "dataSource": {
      "$ref": "#/$defs/Dashboards_API_DashboardScheduleDataSource"
    },
    "dataTimespan": {
      "$ref": "#/$defs/Dashboards_API_DashboardScheduleTimespan"
    },
    "flagEnabled": {
      "type": "boolean",
      "description": "When `true`, the schedule is active and snapshots are generated according to `cronSpec`."
    },
    "flagLocked": {
      "type": "boolean",
      "description": "When `true`, the schedule configuration is locked and cannot be edited through the web application."
    },
    "flagAutoShare": {
      "type": "boolean",
      "description": "When `true`, generated snapshots are automatically shared with schedule recipients."
    },
    "flagIsIncludePiiUserData": {
      "type": "boolean",
      "description": "When `true`, generated snapshots include personally identifiable user data when permitted by account policy."
    },
    "flagAttachPdfToEmail": {
      "type": "boolean",
      "description": "When `true`, a PDF attachment is included in snapshot notification emails."
    },
    "recipients": {
      "type": "array",
      "uniqueItems": true,
      "description": "Email addresses of active dashboard account users who receive snapshot notifications. Unknown or duplicate addresses are rejected.",
      "items": {
        "type": "string",
        "format": "email"
      }
    },
    "expiresAfter": {
      "type": "integer",
      "format": "int64",
      "default": 157680000,
      "minimum": 86400,
      "maximum": 157680000,
      "description": "Snapshot retention period in seconds. Allowed range is 24 hours to 5 years. Defaults to 5 years when omitted."
    }
  },
  "$defs": {
    "Dashboards_API_DashboardScheduleAfterEndCondition": {
      "type": "object",
      "required": [
        "endConditionType",
        "value"
      ],
      "properties": {
        "endConditionType": {
          "type": "string",
          "pattern": "^AFTER$",
          "description": "Identifies a schedule that ends after a number of occurrences."
        },
        "value": {
          "type": "integer",
          "format": "int64",
          "minimum": 1,
          "description": "Number of schedule occurrences after which the recurrence ends."
        }
      }
    },
    "Dashboards_API_DashboardScheduleCronSpec": {
      "description": "Cron-style recurrence specification for a dashboard snapshot schedule.",
      "type": "object",
      "required": [
        "repeat",
        "startTime",
        "zoneCode"
      ],
      "oneOf": [
        {
          "$ref": "#/$defs/Dashboards_API_DashboardScheduleNonCustomCronSpec"
        },
        {
          "$ref": "#/$defs/Dashboards_API_DashboardScheduleCustomCronSpec"
        }
      ],
      "not": {
        "required": [
          "endRepeat"
        ],
        "properties": {
          "repeat": {
            "$ref": "#/$defs/Dashboards_API_DashboardScheduleOneTimeRepeatType"
          }
        }
      },
      "properties": {
        "startTime": {
          "type": "integer",
          "format": "int64",
          "minimum": 0,
          "description": "Schedule start time as a Unix timestamp in seconds."
        },
        "zoneCode": {
          "type": "string",
          "description": "An IANA time zone identifier used to interpret `startTime` and recurrence. For example, `America/Los_Angeles`."
        },
        "repeat": {
          "$ref": "#/$defs/Dashboards_API_DashboardScheduleRepeat"
        },
        "endRepeat": {
          "$ref": "#/$defs/Dashboards_API_DashboardScheduleEndCondition"
        }
      }
    },
    "Dashboards_API_DashboardScheduleCustomCronSpec": {
      "type": "object",
      "required": [
        "customRepeat"
      ],
      "properties": {
        "repeat": {
          "$ref": "#/$defs/Dashboards_API_DashboardScheduleCustomRepeatType"
        },
        "customRepeat": {
          "$ref": "#/$defs/Dashboards_API_DashboardScheduleCustomRepeat"
        }
      }
    },
    "Dashboards_API_DashboardScheduleCustomRepeat": {
      "type": "object",
      "required": [
        "repeatEvery",
        "repeatUnit"
      ],
      "not": {
        "required": [
          "daysOfWeek"
        ],
        "properties": {
          "repeatUnit": {
            "$ref": "#/$defs/Dashboards_API_DashboardScheduleNonWeeklyCustomRepeatUnit"
          }
        }
      },
      "properties": {
        "repeatEvery": {
          "type": "integer",
          "format": "int32",
          "minimum": 1,
          "maximum": 99,
          "description": "Interval count for custom recurrence."
        },
        "daysOfWeek": {
          "type": "array",
          "uniqueItems": true,
          "description": "Days of the week for custom weekly recurrence (`1` = Monday through `7` = Sunday).",
          "items": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 7
          }
        },
        "repeatUnit": {
          "$ref": "#/$defs/Dashboards_API_DashboardScheduleCustomRepeatUnit"
        }
      }
    },
    "Dashboards_API_DashboardScheduleCustomRepeatType": {
      "type": "string",
      "enum": [
        "CUSTOM"
      ]
    },
    "Dashboards_API_DashboardScheduleCustomRepeatUnit": {
      "type": "string",
      "enum": [
        "DAY",
        "WEEK",
        "MONTH"
      ]
    },
    "Dashboards_API_DashboardScheduleDataSource": {
      "type": "object",
      "description": "Naming configuration for snapshots generated by the schedule. The required `dataTimespan` property on the schedule controls the snapshot data range.\n",
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "description": "Name assigned to snapshots generated by the schedule."
        }
      }
    },
    "Dashboards_API_DashboardScheduleDateEndCondition": {
      "type": "object",
      "required": [
        "endConditionType",
        "value"
      ],
      "properties": {
        "endConditionType": {
          "type": "string",
          "pattern": "^DATE$",
          "description": "Identifies a schedule that ends on a specified date."
        },
        "value": {
          "type": "integer",
          "format": "int64",
          "minimum": 0,
          "description": "Unix timestamp in seconds when the recurrence ends."
        }
      }
    },
    "Dashboards_API_DashboardScheduleEndCondition": {
      "description": "Condition that determines when the recurring schedule ends.",
      "oneOf": [
        {
          "$ref": "#/$defs/Dashboards_API_DashboardScheduleNeverEndCondition"
        },
        {
          "$ref": "#/$defs/Dashboards_API_DashboardScheduleAfterEndCondition"
        },
        {
          "$ref": "#/$defs/Dashboards_API_DashboardScheduleDateEndCondition"
        }
      ]
    },
    "Dashboards_API_DashboardScheduleNeverEndCondition": {
      "type": "object",
      "required": [
        "endConditionType"
      ],
      "not": {
        "required": [
          "value"
        ]
      },
      "properties": {
        "endConditionType": {
          "type": "string",
          "pattern": "^NEVER$",
          "description": "Identifies a schedule that never ends."
        }
      }
    },
    "Dashboards_API_DashboardScheduleNonCustomCronSpec": {
      "type": "object",
      "not": {
        "required": [
          "customRepeat"
        ]
      },
      "properties": {
        "repeat": {
          "$ref": "#/$defs/Dashboards_API_DashboardScheduleNonCustomRepeat"
        }
      }
    },
    "Dashboards_API_DashboardScheduleNonCustomRepeat": {
      "type": "string",
      "enum": [
        "NONE",
        "EVERY_DAY",
        "ALT_EVERY_DAY",
        "EVERY_WEEK",
        "EVERY_MONTH",
        "EVERY_TWO_WEEKS",
        "EVERY_THREE_MONTHS"
      ]
    },
    "Dashboards_API_DashboardScheduleNonWeeklyCustomRepeatUnit": {
      "type": "string",
      "enum": [
        "DAY",
        "MONTH"
      ]
    },
    "Dashboards_API_DashboardScheduleOneTimeRepeatType": {
      "type": "string",
      "enum": [
        "NONE"
      ]
    },
    "Dashboards_API_DashboardScheduleRepeat": {
      "type": "string",
      "description": "Schedule repetition pattern. Use `NONE` to generate one snapshot at `startTime`.",
      "enum": [
        "NONE",
        "EVERY_DAY",
        "ALT_EVERY_DAY",
        "EVERY_WEEK",
        "EVERY_MONTH",
        "EVERY_TWO_WEEKS",
        "EVERY_THREE_MONTHS",
        "CUSTOM"
      ]
    },
    "Dashboards_API_DashboardScheduleTimespan": {
      "type": "object",
      "description": "Amount of historical data to include in each scheduled snapshot.",
      "required": [
        "n",
        "period"
      ],
      "properties": {
        "n": {
          "type": "integer",
          "format": "int32",
          "minimum": 1,
          "description": "Number of time units in the snapshot data range."
        },
        "period": {
          "$ref": "#/$defs/Dashboards_API_DashboardScheduleTimespanPeriod"
        }
      }
    },
    "Dashboards_API_DashboardScheduleTimespanPeriod": {
      "type": "string",
      "enum": [
        "DAY",
        "WEEK",
        "MONTH"
      ]
    }
  }
}