{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://openadhkar.org/v1/schema/releases.schema.json",
  "title": "Open Adhkar releases",
  "type": "object",
  "required": [
    "api_version",
    "collections"
  ],
  "properties": {
    "$schema": {
      "type": "string"
    },
    "api_version": {
      "const": 1
    },
    "generated": {
      "type": "string",
      "minLength": 1
    },
    "licence": {
      "type": "string",
      "minLength": 1
    },
    "collections": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "title",
          "latest",
          "versions"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "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"
              ]
            }
          },
          "latest": {
            "type": "string",
            "minLength": 1
          },
          "versions": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "version",
                "released",
                "status",
                "base_url",
                "files"
              ],
              "properties": {
                "version": {
                  "type": "string",
                  "minLength": 1
                },
                "released": {
                  "type": "string",
                  "minLength": 1
                },
                "status": {
                  "type": "string",
                  "minLength": 1
                },
                "base_url": {
                  "type": "string",
                  "minLength": 1
                },
                "path": {
                  "type": "string",
                  "minLength": 1
                },
                "counts": {
                  "type": "object"
                },
                "languages": {
                  "type": "array"
                },
                "changes": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "files": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "path",
                      "format",
                      "bytes",
                      "sha256"
                    ],
                    "properties": {
                      "path": {
                        "type": "string",
                        "minLength": 1
                      },
                      "format": {
                        "enum": [
                          "json",
                          "sqlite",
                          "csv"
                        ]
                      },
                      "bytes": {
                        "type": "integer"
                      },
                      "sha256": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      },
                      "description": {
                        "type": "string",
                        "minLength": 1
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
