{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://kotowa.gellyfish.dev/pack-manifest.schema.json",
  "title": "Kotowa pack manifest (manifest.json)",
  "$comment": "Field meanings: https://kotowa.gellyfish.dev/pack-format.html. The app checks less than this schema does.",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "sourceLanguage": {
      "$ref": "#/$defs/LanguageCode"
    },
    "targetLanguages": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/LanguageCode"
      }
    },
    "license": {
      "type": "string"
    },
    "attribution": {
      "type": "string"
    },
    "credits": {
      "type": "string"
    },
    "units": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ContentPackUnitRef"
      }
    },
    "videos": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ContentPackVideo"
      }
    },
    "schemaVersion": {
      "type": "number"
    },
    "contentHash": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "title",
    "sourceLanguage",
    "targetLanguages",
    "license",
    "units"
  ],
  "$defs": {
    "LanguageCode": {
      "type": "string"
    },
    "ContentPackUnitRef": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "order": {
          "type": "string"
        },
        "parentId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "day": {
          "type": "string"
        },
        "moment": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "labelNote": {
          "type": "string"
        },
        "kind": {
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "itemCount": {
          "type": "number"
        },
        "part": {
          "type": "number"
        },
        "bytes": {
          "type": "number"
        },
        "contentVersion": {
          "type": "string"
        },
        "mediaBytes": {
          "type": "number"
        },
        "image": {
          "type": "object",
          "properties": {
            "path": {
              "type": "string"
            },
            "unitId": {
              "type": "string"
            }
          },
          "required": [
            "path",
            "unitId"
          ]
        },
        "videos": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ContentPackUnitVideoSpan"
          }
        }
      },
      "required": [
        "id",
        "title",
        "order",
        "path",
        "itemCount",
        "bytes",
        "mediaBytes"
      ]
    },
    "ContentPackUnitVideoSpan": {
      "type": "object",
      "properties": {
        "video": {
          "type": "string"
        },
        "start": {
          "type": "number"
        },
        "end": {
          "type": "number"
        },
        "itemCount": {
          "type": "number"
        }
      },
      "required": [
        "video",
        "start",
        "end",
        "itemCount"
      ]
    },
    "ContentPackVideo": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "sourceId": {
          "type": "string"
        },
        "sourceUrl": {
          "type": "string"
        },
        "durationSeconds": {
          "type": "number"
        }
      },
      "required": [
        "id",
        "title"
      ]
    }
  }
}
