{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://mariuscomper.uk/politica-si-pachetul/schema/registry-1.0.json",
  "title": "Romanian Public App Registry 1.0",
  "type": "object",
  "required": ["schema_version", "catalogue_cutoff", "apps"],
  "properties": {
    "schema_version": {"type": "string"},
    "catalogue_cutoff": {"type": "string", "format": "date"},
    "truth_status": {"$ref": "#/$defs/bilingual"},
    "apps": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "name", "package_id", "platforms", "institution", "store_publisher", "relationship", "category", "scope", "region", "summary", "catalogue_status", "audit_level", "sources", "claim_boundary"],
        "properties": {
          "id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9-]+$"},
          "name": {"type": "string"},
          "package_id": {"type": "string"},
          "platforms": {"type": "array", "items": {"type": "string"}},
          "institution": {"type": "string"},
          "store_publisher": {"type": "string"},
          "relationship": {"type": "string", "enum": ["direct_public", "commissioned_private", "public_private_service", "practical_gateway"]},
          "category": {"type": "string"},
          "scope": {"type": "string"},
          "region": {"type": "string"},
          "summary": {"$ref": "#/$defs/bilingual"},
          "candidate_journeys": {"$ref": "#/$defs/bilingualArray"},
          "public_interest": {"$ref": "#/$defs/bilingualArray"},
          "catalogue_status": {"const": "registered_not_audited"},
          "audit_level": {"const": "R0"},
          "last_catalogue_verification": {"type": "string", "format": "date"},
          "sources": {"type": "array", "items": {"type": "object", "required": ["type", "label", "url", "checked"]}},
          "claim_boundary": {"$ref": "#/$defs/bilingual"}
        }
      }
    }
  },
  "$defs": {
    "bilingual": {"type": "object", "required": ["ro", "en"], "properties": {"ro": {"type": "string"}, "en": {"type": "string"}}},
    "bilingualArray": {"type": "object", "required": ["ro", "en"], "properties": {"ro": {"type": "array", "items": {"type": "string"}}, "en": {"type": "array", "items": {"type": "string"}}}}
  }
}
