{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openadhkar.org/v1/schema/collection.schema.json",
  "title": "Open Adhkar collection metadata",
  "type": "object",
  "required": [
    "id",
    "version",
    "released",
    "status",
    "title",
    "author",
    "languages",
    "counts",
    "licence"
  ],
  "properties": {
    "$schema": {
      "type": "string"
    },
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9-]+$"
    },
    "version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$"
    },
    "released": {
      "type": "string",
      "format": "date"
    },
    "status": {
      "enum": [
        "preview",
        "stable"
      ]
    },
    "title": {
      "type": "object",
      "properties": {
        "ar": {
          "type": [
            "string",
            "null"
          ]
        },
        "en": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "ar"
      ],
      "additionalProperties": {
        "type": [
          "string",
          "null"
        ]
      }
    },
    "author": {
      "type": "object",
      "properties": {
        "ar": {
          "type": [
            "string",
            "null"
          ]
        },
        "en": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "ar"
      ],
      "additionalProperties": {
        "type": [
          "string",
          "null"
        ]
      }
    },
    "edition": {
      "type": "object"
    },
    "languages": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "code",
          "role",
          "direction",
          "file"
        ],
        "additionalProperties": false,
        "properties": {
          "code": {
            "type": "string",
            "description": "BCP 47"
          },
          "role": {
            "enum": [
              "source",
              "translation"
            ]
          },
          "direction": {
            "enum": [
              "rtl",
              "ltr"
            ]
          },
          "file": {
            "type": "string",
            "minLength": 1
          },
          "status": {
            "enum": [
              "machine",
              "machine-retranslated",
              "reviewed"
            ]
          }
        }
      },
      "minItems": 1
    },
    "counts": {
      "type": "object",
      "additionalProperties": {
        "type": "integer"
      }
    },
    "review": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "licence": {
      "type": "object",
      "required": [
        "data",
        "attribution"
      ],
      "properties": {
        "data": {
          "type": "string",
          "minLength": 1
        },
        "attribution": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": {
        "type": "string"
      }
    }
  }
}
