{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Coach Video Marker: markers export, version 1",
  "type": "object",
  "required": [
    "schema",
    "version",
    "exportedAt",
    "generator",
    "timeBase",
    "video",
    "clipSettings",
    "markers"
  ],
  "properties": {
    "schema": {
      "const": "coach-video-marker/markers"
    },
    "version": {
      "const": 1
    },
    "exportedAt": {
      "type": "string",
      "format": "date-time"
    },
    "generator": {
      "type": "string"
    },
    "timeBase": {
      "const": "video"
    },
    "video": {
      "$ref": "#/$defs/video"
    },
    "clipSettings": {
      "type": "object",
      "required": [
        "leadSeconds",
        "lagSeconds",
        "maxClipSeconds"
      ],
      "properties": {
        "leadSeconds": {
          "type": "number",
          "minimum": 0
        },
        "lagSeconds": {
          "type": "number",
          "minimum": 0
        },
        "maxClipSeconds": {
          "const": 30
        }
      }
    },
    "markers": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "index",
          "id",
          "timeSeconds",
          "name",
          "tags",
          "note",
          "url",
          "clip"
        ],
        "properties": {
          "index": {
            "type": "integer",
            "minimum": 1
          },
          "id": {
            "type": "string"
          },
          "timeSeconds": {
            "type": "number",
            "minimum": 0
          },
          "name": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "note": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "clip": {
            "type": "object",
            "required": [
              "startSeconds",
              "endSeconds",
              "durationSeconds",
              "embedUrl"
            ],
            "properties": {
              "startSeconds": {
                "type": "integer",
                "minimum": 0
              },
              "endSeconds": {
                "type": "integer",
                "minimum": 1
              },
              "durationSeconds": {
                "type": "integer",
                "minimum": 1,
                "maximum": 30
              },
              "embedUrl": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  },
  "$defs": {
    "video": {
      "type": "object",
      "required": [
        "provider",
        "id",
        "url",
        "title",
        "durationSeconds"
      ],
      "properties": {
        "provider": {
          "const": "youtube"
        },
        "id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{11}$"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "title": {
          "type": "string"
        },
        "durationSeconds": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        }
      }
    }
  }
}