{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hsimc.tech/assets/hsimc-publication/un6-v1/content.schema.json",
  "title": "HSIMC multilingual publication content",
  "type": "object",
  "required": [
    "publication_id",
    "edition",
    "language",
    "direction",
    "canonical_url",
    "source_master",
    "translation",
    "sections",
    "sources"
  ],
  "properties": {
    "publication_id": {
      "type": "string"
    },
    "edition": {
      "type": "string"
    },
    "language": {
      "type": "string",
      "minLength": 2
    },
    "direction": {
      "enum": [
        "ltr",
        "rtl"
      ]
    },
    "canonical_url": {
      "type": "string",
      "format": "uri"
    },
    "source_master": {
      "type": "object",
      "required": [
        "language",
        "sha256"
      ],
      "properties": {
        "language": {
          "const": "en"
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      }
    },
    "translation": {
      "type": "object"
    },
    "sections": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "id",
          "blocks"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "blocks": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "type",
                "text"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                },
                "text": {
                  "type": "string"
                },
                "source_ids": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      }
    },
    "sources": {
      "type": "array"
    }
  }
}
