{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "@context": {
      "description": "JSON-LD context. Production deployments use the unified register vocabulary context at vocabulary.uncefact.org.",
      "oneOf": [
        { "type": "string", "format": "uri" },
        { "type": "array" },
        { "type": "object" }
      ]
    },
    "@type": {
      "oneOf": [
        { "type": "string" },
        { "type": "array", "items": { "type": "string" } }
      ]
    },
    "id": { "type": "string", "format": "uri" },
    "name": { "type": "string" },
    "description": { "type": "string" },
    "lastUpdated": { "type": "string", "format": "date" },
    "registrar": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": { "type": "string", "format": "uri" },
        "name": { "type": "string" },
        "agent": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": { "type": "string", "format": "uri" },
            "name": { "type": "string" },
            "description": { "type": "string" }
          },
          "required": ["id"]
        }
      },
      "required": ["id", "name"]
    },
    "entries": {
      "type": "array",
      "items": { "$ref": "#/$defs/IdentifierSchemeEntry" }
    }
  },
  "required": ["id", "name", "lastUpdated", "registrar", "entries"],
  "description": "A register of community-tier identifier schemes used by UNTP credentials to identify products, facilities, organisations, members, locations, and key assets. Complements GRID (which catalogues authoritative government-run registers — business registers, land registers, asset registers, trademark registers). IDR is the informal/community tier; GRID is the strictly governed authoritative tier; together they cover the full identifier landscape that UNTP credentials reference. Each entry doubles as a discovery directory (resolver URI templates) and a trust anchor (UNTP-issued DIA credential about the registrar).",
  "$defs": {
    "IdentifierSchemeEntry": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "@type": {
          "oneOf": [
            { "type": "string" },
            { "type": "array", "items": { "type": "string" } }
          ]
        },
        "id": {
          "type": "string",
          "format": "uri",
          "description": "Globally unique identifier for this entry within the register."
        },
        "name": { "type": "string" },
        "shortName": { "type": "string" },
        "owner": {
          "$ref": "#/$defs/SchemeOperator",
          "description": "The organisation that operates this identifier scheme. The `owner.id` (DID) is the cryptographic identity that signs the registration VC; UNECE issues a DIA credential about this DID, hosted at `registrarDia`."
        },
        "statement": {
          "type": "string",
          "description": "Owner-authored description of the scheme's purpose, target entities, and assurance approach."
        },
        "registryServiceURL": {
          "type": "string",
          "format": "uri",
          "description": "Base URL of the registrar's identifier service. The registrar agent crawls this URL during the conformance cycle to verify reachability and IDR specification conformance."
        },
        "documentation": {
          "type": "string",
          "format": "uri",
          "description": "Public landing page for the scheme."
        },
        "identifierType": {
          "type": "string",
          "enum": ["Organisation", "Product", "Facility", "Asset", "Location", "Consignment", "Member", "Person"],
          "description": "What kind of entity this scheme identifies. Resolves via context @vocab to reg:IdentifierType_*."
        },
        "registeredIdPattern": {
          "type": "string",
          "description": "Regex that valid identifiers in this scheme must match."
        },
        "registeredIdExample": { "type": "string" },
        "registeredIdUriTemplate": {
          "type": "string",
          "description": "RFC 6570 URI template for the canonical URI of a registered identifier. MUST accept the variable {id}."
        },
        "resolverEndpoint": {
          "type": "string",
          "description": "RFC 6570 URI template for the UNTP IDR-conformant resolver service. MUST accept {id}."
        },
        "queryEndpoint": {
          "type": "string",
          "description": "RFC 6570 URI template for a human-readable query interface. MUST accept {id}."
        },
        "legalBasis": {
          "type": "string",
          "format": "uri",
          "description": "URL of the charter, governance framework, or scheme rules that establish authority. Authoritative-tier schemes (with statutory backing) belong in GRID, not here."
        },
        "geographicScope": { "$ref": "#/$defs/GeographicScope" },
        "status": {
          "type": "string",
          "enum": ["proposed", "planned", "development", "pilot", "active", "observed", "conformant", "non-conformant", "dormant", "withdrawn"],
          "description": "Lifecycle status. Promoted to `conformant` when the registrar agent confirms `implementsUntpIdr: true` and (where claimed) `issuesDia: true`."
        },
        "implementsUntpIdr": {
          "type": "boolean",
          "description": "Whether the registrar's resolver service implements the UNTP Identity Resolver specification. Owner declares; registrar agent verifies."
        },
        "untpIdrVersion": {
          "type": "string",
          "description": "UNTP IDR specification version the registrar implements (e.g. `0.6.1`)."
        },
        "issuesDia": {
          "type": "boolean",
          "description": "Whether the registrar issues UNTP Digital Identity Anchor (DIA) credentials about entities listed in its registry. When true, identifiers can be resolved to verifiable identity attestations issued by the registrar — extending the trust chain from UNECE through the registrar to its registered entities."
        },
        "diaExtension": {
          "type": "string",
          "format": "uri",
          "description": "Optional. URI of a community DIA extension (registered in the EXT register) that the registrar uses for its DIA credentials. Absent if the registrar uses the UNTP DIA core type as-is."
        },
        "registrarDia": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": { "type": "string", "format": "uri", "description": "URI of the UNECE-issued DIA credential about this registrar." },
            "issuer": { "type": "string", "format": "uri", "description": "DID of UNECE (the issuer)." },
            "issuedAt": { "type": "string", "format": "date-time" },
            "hashAlgorithm": { "type": "string" },
            "hashValue": { "type": "string" }
          },
          "required": ["id", "issuer"],
          "description": "Reference to the DIA credential UNECE issues about this registrar on registration. The DIA binds the registrar's DID to its registered name and the registry it operates. Hosted on the register entry as the trust anchor for downstream verifiers."
        },
        "registrationVc": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": { "type": "string", "format": "uri" },
            "issuer": { "type": "string", "format": "uri" },
            "issuedAt": { "type": "string", "format": "date-time" },
            "hashAlgorithm": { "type": "string" },
            "hashValue": { "type": "string" }
          },
          "required": ["id", "issuer"]
        },
        "mirrorsAuthoritativeRegister": {
          "type": "string",
          "format": "uri",
          "description": "Optional cross-tier reference to the GRID entry this community scheme mirrors or derives authority from (e.g. an industry member registry that mirrors a national business register). Resolves on grid.unece.org/."
        },
        "observedStatus": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "lastObservedAt": { "type": "string", "format": "date-time" },
            "currentAssessment": {
              "type": "string",
              "enum": ["conformant", "non-conformant", "partially-conformant", "insufficient-data"]
            },
            "registryUrlReachable": { "type": "boolean" },
            "resolverTemplateValid": { "type": "boolean" },
            "untpIdrConformant": { "type": "boolean" },
            "diaIssuanceVerified": { "type": "boolean" }
          },
          "required": ["currentAssessment"]
        }
      },
      "required": ["id", "name", "owner", "registryServiceURL", "identifierType", "status"]
    },
    "SchemeOperator": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "@type": {
          "oneOf": [
            { "type": "string" },
            { "type": "array", "items": { "type": "string" } }
          ]
        },
        "id": {
          "type": "string",
          "format": "uri",
          "description": "DID of the registrar organisation."
        },
        "name": { "type": "string" },
        "website": { "type": "string", "format": "uri" }
      },
      "required": ["id", "name"]
    },
    "GeographicScope": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "label": { "type": "string" },
        "countries": { "type": "array", "items": { "type": "string" } },
        "isGlobal": { "type": "boolean" }
      },
      "required": ["label"]
    }
  }
}
