{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Пакет довідника: контракт 1.0.0",
  "description": "Схема оболонки та зв’язків. Вміст data має структуру свого виду запису; не є нормативною валідацією.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "release", "publishedOn", "language", "jurisdiction", "productionReady", "scope", "dependencyMeaning", "resources"],
  "properties": {
    "schemaVersion": {"const": "1.0.0"},
    "release": {"type": "string", "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"},
    "publishedOn": {"type": "string", "format": "date"},
    "language": {"const": "uk"},
    "jurisdiction": {"const": "UA"},
    "productionReady": {"const": false},
    "scope": {"type": "string", "minLength": 1},
    "dependencyMeaning": {"type": "string", "minLength": 1},
    "resources": {"type": "array", "items": {"$ref": "#/$defs/resource"}}
  },
  "$defs": {
    "resource": {
      "type": "object", "additionalProperties": false,
      "required": ["id", "kind", "slug", "name", "href", "dependsOn", "review", "validity", "data"],
      "properties": {
        "id": {"type": "string", "pattern": "^(source|document|rule|calculation|example|research):[a-z0-9-]+$"},
        "kind": {"enum": ["source", "document", "rule", "calculation", "example", "research"]},
        "slug": {"type": "string", "pattern": "^[a-z0-9-]+$"},
        "name": {"type": "string", "minLength": 1},
        "href": {"type": "string", "pattern": "^/"},
        "dependsOn": {"type": "array", "uniqueItems": true, "items": {"type": "string"}},
        "review": {"type": "object", "additionalProperties": false, "required": ["legal", "reviewer"], "properties": {"legal": {"const": "pending"}, "reviewer": {"type": "null"}}},
        "validity": {"type": "object", "additionalProperties": false, "required": ["from", "to"], "properties": {"from": {"type": "null"}, "to": {"type": "null"}}},
        "data": {"type": "object"}
      }
    }
  }
}
