{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/brixsignage-com/json-schema/brixsignage-com-schedule-schema.json",
  "title": "Schedule",
  "description": "A schedule with its timed blocks.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/brixsignage-com-schedules-api-openapi.yml#/components/schemas/Schedule",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Schedule id."
    },
    "spaceId": {
      "type": "string"
    },
    "nodeId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Home location (null = workspace root)."
    },
    "name": {
      "type": "string"
    },
    "fallbackName": {
      "type": "string",
      "description": "Label of the content played between blocks."
    },
    "fallbackMode": {
      "type": "string",
      "enum": [
        "content",
        "off"
      ],
      "description": "Between blocks: play the fallback content, or turn the screens off."
    },
    "fallbackContentKind": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "media",
            "playlist",
            "app",
            "layout",
            "creative",
            "signage"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "fallbackContentId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "playsSolely": {
      "type": "boolean"
    },
    "timeBasis": {
      "type": "string",
      "enum": [
        "device",
        "cms"
      ],
      "description": "Whose clock the block times use: each screen's local time, or the workspace's."
    },
    "startsAt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "`YYYY-MM-DD` or ISO-8601; null = no start bound."
    },
    "expiresAt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "approvalState": {
      "type": "string",
      "enum": [
        "draft",
        "pending",
        "approved",
        "rejected"
      ]
    },
    "createdAt": {
      "type": "string",
      "description": "ISO-8601 timestamp (UTC)."
    },
    "updatedAt": {
      "type": "string",
      "description": "ISO-8601 timestamp (UTC)."
    },
    "deletedAt": {
      "anyOf": [
        {
          "type": "string",
          "description": "ISO-8601 timestamp (UTC)."
        },
        {
          "type": "null"
        }
      ]
    },
    "recalledAt": {
      "anyOf": [
        {
          "type": "string",
          "description": "ISO-8601 timestamp (UTC)."
        },
        {
          "type": "null"
        }
      ],
      "description": "Set while the schedule is recalled (withheld from every screen)."
    },
    "recalledBy": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "approvedSnapshot": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "JSON of the blocks as last approved (approval workflow)."
    },
    "importSourceId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "usedByScreenCount": {
      "type": "integer",
      "description": "Screens assigned this schedule."
    },
    "fallbackContentRef": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "media",
                "playlist",
                "app",
                "layout",
                "creative",
                "signage"
              ]
            },
            "id": {
              "type": "string"
            }
          },
          "required": [
            "kind",
            "id"
          ]
        },
        {
          "type": "null"
        }
      ]
    },
    "fallbackThumbnailUrl": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "blocks": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ScheduleBlock"
      }
    }
  },
  "required": [
    "id",
    "spaceId",
    "nodeId",
    "name",
    "fallbackName",
    "fallbackMode",
    "fallbackContentKind",
    "fallbackContentId",
    "playsSolely",
    "timeBasis",
    "startsAt",
    "expiresAt",
    "approvalState",
    "createdAt",
    "updatedAt",
    "deletedAt",
    "recalledAt",
    "recalledBy",
    "approvedSnapshot",
    "importSourceId",
    "usedByScreenCount",
    "fallbackContentRef",
    "fallbackThumbnailUrl",
    "blocks"
  ],
  "$defs": {
    "ScheduleBlock": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Schedule block id."
        },
        "label": {
          "type": "string"
        },
        "daysOfWeek": {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 0,
            "maximum": 6
          },
          "description": "0 = Sunday … 6 = Saturday. Empty = every day."
        },
        "startTime": {
          "type": "string",
          "description": "24-hour `HH:MM`."
        },
        "endTime": {
          "type": "string",
          "description": "24-hour `HH:MM`; `00:00` = midnight. An end before the start wraps overnight."
        },
        "priority": {
          "type": "integer",
          "description": "0–1000; higher wins where blocks overlap."
        },
        "startDate": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "`YYYY-MM-DD`, or null for no start bound."
        },
        "endDate": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "repeatEveryWeeks": {
          "type": "integer",
          "description": "1–52."
        },
        "refKind": {
          "type": "string",
          "enum": [
            "media",
            "playlist",
            "app",
            "layout",
            "creative",
            "signage"
          ]
        },
        "refId": {
          "type": "string"
        },
        "screensOff": {
          "type": "boolean",
          "description": "The block turns the screens off instead of playing `ref`."
        },
        "contentName": {
          "type": "string",
          "description": "Current name of the content, `Screens off`, or `(missing content)` when the ref no longer resolves."
        },
        "thumbnailUrl": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "position": {
          "type": "integer"
        }
      },
      "required": [
        "id",
        "label",
        "daysOfWeek",
        "startTime",
        "endTime",
        "priority",
        "startDate",
        "endDate",
        "repeatEveryWeeks",
        "refKind",
        "refId",
        "screensOff",
        "contentName",
        "thumbnailUrl",
        "position"
      ]
    }
  }
}