{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://choicervoicer.net/schemas/voice-pack-v1.schema.json",
  "title": "Choicer Voicer Lab Voice Pack v1",
  "description": "An original, browser-friendly voice pack format for Choicer Voicer Lab tools.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "schemaVersion",
    "id",
    "title",
    "author",
    "description",
    "language",
    "license",
    "createdAt",
    "clips"
  ],
  "properties": {
    "schema": {
      "const": "choicer-voicer-lab.voice-pack"
    },
    "schemaVersion": {
      "const": 1
    },
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
      "maxLength": 64
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "author": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "description": {
      "type": "string",
      "minLength": 1,
      "maxLength": 400
    },
    "language": {
      "type": "string",
      "minLength": 1,
      "maxLength": 32
    },
    "license": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "sourceUrl": {
      "type": "string",
      "format": "uri",
      "maxLength": 300
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "clips": {
      "type": "array",
      "minItems": 1,
      "maxItems": 16,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "title",
          "audio",
          "line",
          "role",
          "instruction",
          "tags",
          "difficulty"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
            "maxLength": 64
          },
          "title": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "audio": {
            "type": "string",
            "pattern": "^audio/[A-Za-z0-9._-]+\\.(wav|mp3|ogg|m4a|aac|webm)$",
            "maxLength": 240
          },
          "line": {
            "type": "string",
            "minLength": 1,
            "maxLength": 180
          },
          "role": {
            "type": "string",
            "minLength": 1,
            "maxLength": 80
          },
          "instruction": {
            "type": "string",
            "minLength": 1,
            "maxLength": 180
          },
          "tags": {
            "type": "array",
            "maxItems": 12,
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 32
            }
          },
          "difficulty": {
            "enum": ["easy", "medium", "bold"]
          },
          "image": {
            "type": "string",
            "pattern": "^images/[A-Za-z0-9._-]+\\.(png|jpg|jpeg|webp|gif)$",
            "maxLength": 240
          }
        }
      }
    }
  }
}
