{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/fwozen-com/json-schema/fwozen-com-schedule-schema.json",
  "title": "Schedule",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/fwozen-com-openapi.yml#/components/schemas/Schedule",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^sch_[1-9A-HJ-NP-Za-km-z]{16}$"
    },
    "name": {
      "type": "string"
    },
    "enabled": {
      "type": "boolean"
    },
    "version": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "scope": {
      "$ref": "#/$defs/FreezeScope"
    },
    "reason": {
      "type": "string"
    },
    "timezone": {
      "type": "string"
    },
    "recurrence": {
      "type": "string",
      "enum": [
        "one_off",
        "daily",
        "weekly",
        "monthly_by_date"
      ]
    },
    "startTimeLocal": {
      "type": "string",
      "pattern": "^([01]\\d|2[0-3]):[0-5]\\d(:[0-5]\\d)?$"
    },
    "endTimeLocal": {
      "type": "string",
      "pattern": "^([01]\\d|2[0-3]):[0-5]\\d(:[0-5]\\d)?$"
    },
    "endDayOffset": {
      "default": 0,
      "type": "integer",
      "minimum": 0,
      "maximum": 14
    },
    "daysOfWeek": {
      "minItems": 1,
      "maxItems": 7,
      "type": "array",
      "items": {
        "type": "integer",
        "minimum": 1,
        "maximum": 7
      }
    },
    "daysOfMonth": {
      "minItems": 1,
      "maxItems": 31,
      "type": "array",
      "items": {
        "type": "integer",
        "minimum": -1,
        "maximum": 31
      }
    },
    "oneOffStartsAt": {
      "type": "string",
      "format": "date-time"
    },
    "oneOffEndsAt": {
      "type": "string",
      "format": "date-time"
    },
    "derivedDurationSeconds": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991
    },
    "activeFrom": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
        },
        {
          "type": "null"
        }
      ]
    },
    "activeUntil": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
        },
        {
          "type": "null"
        }
      ]
    },
    "reminders": {
      "type": "array",
      "items": {
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991
      }
    },
    "announce": {
      "type": "boolean"
    },
    "allowExceptions": {
      "type": "boolean"
    },
    "blocksDeploys": {
      "type": "boolean"
    },
    "blocksMergeQueue": {
      "type": "boolean"
    },
    "recurrenceLabel": {
      "type": "string"
    },
    "nextOccurrence": {
      "anyOf": [
        {
          "$ref": "#/$defs/Occurrence"
        },
        {
          "type": "null"
        }
      ]
    },
    "lastFiredAt": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
        },
        {
          "type": "null"
        }
      ]
    },
    "lastFireError": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "createdBy": {
      "$ref": "#/$defs/Actor"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
    }
  },
  "required": [
    "id",
    "name",
    "enabled",
    "version",
    "scope",
    "reason",
    "timezone",
    "recurrence",
    "endDayOffset",
    "derivedDurationSeconds",
    "activeFrom",
    "activeUntil",
    "reminders",
    "announce",
    "allowExceptions",
    "blocksDeploys",
    "blocksMergeQueue",
    "recurrenceLabel",
    "nextOccurrence",
    "lastFiredAt",
    "lastFireError",
    "createdBy",
    "createdAt",
    "updatedAt"
  ],
  "additionalProperties": false,
  "$defs": {
    "Actor": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "user",
            "api_key",
            "slack_user",
            "scheduler",
            "system",
            "github_user"
          ]
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "displayName": {
          "type": "string"
        },
        "githubLogin": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "slackUserId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "impersonatorId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "apiKeyKind": {
          "default": null,
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "human",
                "agent"
              ]
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "type",
        "id",
        "displayName",
        "githubLogin",
        "slackUserId",
        "impersonatorId",
        "apiKeyKind"
      ],
      "additionalProperties": false
    },
    "FreezeScope": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "org"
            },
            "branches": {
              "default": [
                "~DEFAULT_BRANCH"
              ],
              "minItems": 1,
              "maxItems": 20,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255
              }
            }
          },
          "required": [
            "kind",
            "branches"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "repos"
            },
            "repoIds": {
              "minItems": 1,
              "maxItems": 500,
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^repo_[1-9A-HJ-NP-Za-km-z]{16}$"
              }
            },
            "branches": {
              "default": [
                "~DEFAULT_BRANCH"
              ],
              "minItems": 1,
              "maxItems": 20,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255
              }
            }
          },
          "required": [
            "kind",
            "repoIds",
            "branches"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "branches"
            },
            "branchIds": {
              "minItems": 1,
              "maxItems": 2000,
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^wbr_[1-9A-HJ-NP-Za-km-z]{16}$"
              }
            }
          },
          "required": [
            "kind",
            "branchIds"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "const": "glob"
            },
            "patterns": {
              "minItems": 1,
              "maxItems": 20,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              }
            },
            "excludePatterns": {
              "default": [],
              "maxItems": 20,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200
              }
            },
            "branches": {
              "default": [
                "~DEFAULT_BRANCH"
              ],
              "minItems": 1,
              "maxItems": 20,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255
              }
            },
            "includeArchived": {
              "default": false,
              "type": "boolean"
            }
          },
          "required": [
            "kind",
            "patterns",
            "excludePatterns",
            "branches",
            "includeArchived"
          ],
          "additionalProperties": false
        }
      ]
    },
    "Occurrence": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^occ_[1-9A-HJ-NP-Za-km-z]{16}$"
        },
        "scheduleId": {
          "type": "string",
          "pattern": "^sch_[1-9A-HJ-NP-Za-km-z]{16}$"
        },
        "scheduleName": {
          "type": "string"
        },
        "startsAt": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
        },
        "endsAt": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
        },
        "startsAtLocal": {
          "type": "string"
        },
        "endsAtLocal": {
          "type": "string"
        },
        "durationSeconds": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "dstAdjusted": {
          "type": "boolean"
        },
        "state": {
          "type": "string",
          "enum": [
            "planned",
            "applied",
            "lifted",
            "skipped",
            "canceled",
            "failed"
          ]
        },
        "freezeId": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^frz_[1-9A-HJ-NP-Za-km-z]{16}$"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "id",
        "scheduleId",
        "scheduleName",
        "startsAt",
        "endsAt",
        "startsAtLocal",
        "endsAtLocal",
        "durationSeconds",
        "dstAdjusted",
        "state",
        "freezeId"
      ],
      "additionalProperties": false
    }
  }
}