{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://loop.firmiana.si/news/v1/events.schema.json",
  "title": "Livestreams, keynotes and launch events (events.json)",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "version", "generated_at", "license", "events"],
  "properties": {
    "schema": { "type": "string", "format": "uri" },
    "version": { "const": 1 },
    "generated_at": { "type": "string", "format": "date-time" },
    "license": { "const": "CC-BY-4.0" },
    "events": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "provider", "host", "kind", "title", "title_zh", "starts_at", "ends_at", "date_only", "timezone", "state", "source_url", "watch_url", "replay_url", "embed", "checked"],
        "properties": {
          "id": { "type": "string", "pattern": "^[a-z0-9-]+$" },
          "provider": { "type": "string" },
          "host": { "type": "string" },
          "host_zh": { "type": ["string", "null"] },
          "kind": { "enum": ["keynote", "livestream", "conference", "launch"] },
          "title": { "type": "string" },
          "title_zh": { "type": "string" },
          "starts_at": { "type": "string", "format": "date-time" },
          "ends_at": { "type": ["string", "null"], "format": "date-time" },
          "date_only": { "type": "boolean", "description": "The official page gives dates but no times" },
          "timezone": { "type": "string", "description": "The organiser's IANA time zone" },
          "location": { "type": ["string", "null"] },
          "location_zh": { "type": ["string", "null"] },
          "state": { "enum": ["upcoming", "live", "ended"], "description": "At build time, from the official schedule. Clients should recompute from starts_at/ends_at" },
          "source_url": { "type": "string", "format": "uri", "description": "Official event page the times come from" },
          "watch_url": { "type": ["string", "null"], "format": "uri", "description": "Official watch page" },
          "replay_url": { "type": ["string", "null"], "format": "uri" },
          "embed": { "$ref": "events-source.schema.json#/$defs/embed" },
          "checked": { "type": "string", "format": "date" }
        }
      }
    }
  }
}
