{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://storylibrary.torahlearningtools.com/schemas/playlists-1.json",
  "title": "Goldstein Story Archive playlists",
  "type": "object",
  "required": [
    "format",
    "version",
    "playlists"
  ],
  "additionalProperties": false,
  "properties": {
    "format": {
      "const": "goldstein-playlists"
    },
    "version": {
      "const": 1
    },
    "exported": {
      "type": "string",
      "format": "date-time"
    },
    "site": {
      "type": "string",
      "format": "uri"
    },
    "playlists": {
      "type": "array",
      "maxItems": 100,
      "items": {
        "type": "object",
        "required": [
          "id",
          "name",
          "items"
        ],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9]{12}$"
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          "note": {
            "type": "string",
            "maxLength": 2000
          },
          "created": {
            "type": "string",
            "format": "date-time"
          },
          "updated": {
            "type": "string",
            "format": "date-time"
          },
          "origin": {
            "type": "string",
            "maxLength": 200,
            "description": "e.g. 'tonight:2026-11-25:calm' when copied from tonight's playlists"
          },
          "items": {
            "type": "array",
            "maxItems": 500,
            "items": {
              "type": "object",
              "required": [
                "rec"
              ],
              "additionalProperties": false,
              "properties": {
                "rec": {
                  "type": "string",
                  "pattern": "^[0-9a-f]{10}$"
                },
                "start": {
                  "type": "number",
                  "minimum": 0
                },
                "end": {
                  "type": "number",
                  "exclusiveMinimum": 0
                },
                "label": {
                  "type": "string",
                  "maxLength": 200,
                  "description": "segment title when start/end are set"
                },
                "note": {
                  "type": "string",
                  "maxLength": 1000
                },
                "title": {
                  "type": "string",
                  "maxLength": 300,
                  "description": "snapshot for readability; refreshed on import"
                },
                "dur": {
                  "type": "number",
                  "minimum": 0
                }
              }
            }
          }
        }
      }
    }
  }
}