{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "@context": {
      "description": "JSON-LD context. Production deployments use the published register vocabulary contexts at vocabulary.uncefact.org so that register.json is processable as Linked Data.",
      "oneOf": [
        { "type": "string", "format": "uri" },
        { "type": "array" },
        { "type": "object" }
      ]
    },
    "@type": {
      "oneOf": [
        { "type": "string" },
        { "type": "array", "items": { "type": "string" } }
      ]
    },
    "id": {
      "type": "string",
      "format": "uri",
      "description": "Globally unique identifier for this register."
    },
    "name": {
      "type": "string",
      "description": "The name of this register."
    },
    "description": {
      "type": "string",
      "description": "Purpose and scope of this register."
    },
    "lastUpdated": {
      "type": "string",
      "format": "date",
      "description": "The date this register was last updated."
    },
    "registrar": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uri",
          "description": "Globally unique identifier of the registrar organisation."
        },
        "name": {
          "type": "string",
          "description": "Name of the registrar organisation."
        },
        "agent": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string",
              "format": "uri",
              "description": "DID of the autonomous registrar agent that discovers UNTP credentials, validates them, and issues conformance observations recorded against software versions in this register."
            },
            "name": {
              "type": "string"
            },
            "description": {
              "type": "string"
            }
          },
          "required": ["id"],
          "description": "The autonomous agent operated by the registrar that performs credential discovery and conformance assessment. Observations recorded in this register are signed by this agent."
        }
      },
      "required": ["id", "name"],
      "description": "The organisation responsible for maintaining this register."
    },
    "entries": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/VendorEntry"
      },
      "description": "Vendor entries. Vendor metadata is curated; software version observations are appended automatically by the registrar agent."
    }
  },
  "required": ["id", "name", "lastUpdated", "registrar", "entries"],
  "description": "A register of software vendors that implement the UN Transparency Protocol (UNTP). Designed to be self-updating: after an initial vendor (DID) seeding step, the registrar agent discovers UNTP credentials via the Identity Resolver (IDR), inspects each credential's `issuingSoftware` block to identify the software version that issued it, validates the credential against UNTP core and any registered extension schemas/vocabularies, and appends conformance observations against the corresponding software version.",
  "$defs": {
    "VendorEntry": {
      "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."
        },
        "vendor": {
          "$ref": "#/$defs/Vendor",
          "description": "The software vendor. The `vendor.id` (DID) is the seed identity used by the registrar agent to correlate observed credentials with this entry — it MUST match the `issuingSoftware.vendor.id` value in credentials issued by this vendor's software."
        },
        "statement": {
          "type": "string",
          "description": "Vendor implementation statement: why UNTP matters to them and how they intend to use it."
        },
        "commitmentDate": {
          "type": "string",
          "format": "date",
          "description": "Date the vendor committed to UNTP implementation."
        },
        "pilotParticipation": {
          "type": "boolean",
          "description": "Whether the vendor participates in pre-release UNTP pilots."
        },
        "declaredUntpScope": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": ["VCP", "DPP", "DTE", "DCC", "DFR", "IDR", "DIA", "DAC", "SVC"]
          },
          "description": "UNTP specification components the vendor states their products will support."
        },
        "status": {
          "type": "string",
          "enum": ["planned", "active", "observed", "conformant", "non-conformant", "withdrawn"],
          "description": "Vendor lifecycle status. `planned`/`active` are curated by the registrar based on vendor declarations; `observed`/`conformant`/`non-conformant` are derived by the registrar agent from the latest observations on the vendor's software versions; `withdrawn` is set when the vendor exits the program."
        },
        "industryFocus": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/IndustryFocus"
          },
          "description": "Industry sectors and process areas targeted by this vendor."
        },
        "bindingCredentialDiscovery": {
          "$ref": "#/$defs/BindingCredentialDiscovery",
          "description": "Optional. If present, the vendor offers binding credentials — vendor-signed counter-claims that confirm a given UNTP credential was actually issued by a given software version. The registrar agent fetches a binding credential per observed UNTP credential and adds a binding-pass/fail dimension to the observation. This protects against forged `issuingSoftware` claims by malicious deployers."
        },
        "products": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SoftwareProduct"
          },
          "description": "Software products offered by this vendor."
        },
        "observedStatus": {
          "$ref": "#/$defs/ObservedStatus",
          "description": "Aggregate, registrar-agent-maintained roll-up across all software versions of all products. Recomputed on each observation cycle; never edited by hand."
        }
      },
      "required": ["id", "vendor", "commitmentDate", "status", "products"],
      "description": "A registered software vendor."
    },
    "Vendor": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uri",
          "description": "DID of the vendor. This is the cryptographic identity that appears in the `issuingSoftware.vendor.id` field of every UNTP credential issued by this vendor's software, and is the anchor used by the registrar agent to correlate discovered credentials with this entry."
        },
        "name": {
          "type": "string",
          "description": "Vendor organisation name."
        },
        "website": {
          "type": "string",
          "format": "uri"
        },
        "registrationCountry": {
          "type": "string",
          "description": "ISO 3166-1 country name where the vendor is legally registered."
        },
        "operatingCountries": {
          "type": "string",
          "description": "Countries or regions where the vendor operates (e.g. 'Global', 'Canada')."
        },
        "logo": {
          "type": "string",
          "format": "uri",
          "description": "Vendor logo URL."
        }
      },
      "required": ["id", "name"]
    },
    "SoftwareProduct": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "description": "Product name."
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Product or documentation URL."
        },
        "description": {
          "type": "string"
        },
        "declaredUntpScope": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": ["VCP", "DPP", "DTE", "DCC", "DFR", "IDR", "DIA", "DAC", "SVC"]
          },
          "description": "UNTP components the product is intended to support."
        },
        "declaredUntpVersions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Transitional. UNTP specification versions the vendor states this product targets (e.g. `0.5`, `0.6`, `1.0`, or `all`). Use only until the vendor mints a `softwareVersionId` per build, after which `versions[]` is the canonical record and this field SHOULD be removed."
        },
        "versions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SoftwareVersion"
          },
          "description": "Released versions of this product. Each version is the unit at which conformance is observed and reported."
        }
      },
      "required": ["name"]
    },
    "SoftwareVersion": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "softwareVersionId": {
          "type": "string",
          "format": "uri",
          "description": "URI uniquely identifying this software build. MUST match the `issuingSoftware.id` value in any UNTP credential issued by this build. Stable across the build's lifetime."
        },
        "versionLabel": {
          "type": "string",
          "description": "Human-readable version label (e.g. semver `2.4.1`, calver `2026.04.30`)."
        },
        "releasedDate": {
          "type": "string",
          "format": "date"
        },
        "sbomReference": {
          "$ref": "#/$defs/ScittStatementReference",
          "description": "Optional reference to a SCITT-anchored Software Bill of Materials for this build, declared by the vendor."
        },
        "observations": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ConformanceObservation"
          },
          "description": "Conformance observations recorded by the registrar agent for credentials it discovered that were issued by this software version. Append-only."
        }
      },
      "required": ["softwareVersionId", "versionLabel"]
    },
    "ScittStatementReference": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "format": "uri",
          "description": "URI of the SCITT statement that anchors the SBOM."
        },
        "hashAlgorithm": {
          "type": "string",
          "examples": ["sha-256", "sha-384"]
        },
        "hashValue": {
          "type": "string",
          "description": "Hex-encoded hash of the SBOM document the SCITT statement anchors."
        }
      },
      "required": ["id"]
    },
    "BindingCredentialDiscovery": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "uriTemplate": {
          "type": "string",
          "description": "RFC 6570 URI template that resolves to a vendor-issued binding credential for a given UNTP credential. MUST accept the variable `{credentialId}` (URL-encoded UNTP credential ID). The resolved binding credential is a Verifiable Credential whose `credentialSubject` lists `(untpCredentialId, softwareVersionId)` pairs and whose issuer is a delegated DID (see `delegationModel`)."
        },
        "delegationModel": {
          "type": "string",
          "enum": ["per-customer-deployment", "per-software-version", "vendor-root"],
          "description": "How the binding credential's signing DID relates to the vendor root DID. `per-customer-deployment` (recommended): the vendor issues a delegate DID to each customer deployment, and binding credentials are signed by that delegate — keeping vendor root keys off customer premises. `per-software-version`: one delegate DID per build. `vendor-root`: signed directly by the vendor DID (only safe for SaaS where the vendor controls the issuing environment)."
        },
        "delegateDiscovery": {
          "type": "string",
          "format": "uri",
          "description": "Optional. URI of a vendor-published list (or DID Document service endpoint) enumerating currently-authorised delegate DIDs, so that a verifier can confirm the binding credential was signed by an authorised delegate of the vendor root."
        }
      },
      "required": ["uriTemplate", "delegationModel"]
    },
    "ConformanceObservation": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "observedAt": {
          "type": "string",
          "format": "date-time",
          "description": "Time at which the registrar agent completed this observation cycle."
        },
        "untpVersion": {
          "type": "string",
          "description": "UNTP core specification version against which credentials were validated (e.g. `0.6.1`)."
        },
        "credentialType": {
          "type": "string",
          "description": "The primary UNTP credential type observed (e.g. `DigitalProductPassport`, `DigitalConformityCredential`)."
        },
        "extensionsDetected": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "type": {
                "type": "string",
                "description": "The extension type asserted in the credential's `type` array (e.g. `DigitalBatteryPassport`)."
              },
              "extensionRegistryEntry": {
                "type": "string",
                "format": "uri",
                "description": "Pointer to the entry in the UNTP Extensions Register against whose schema and vocabulary the registrar agent validated the credential."
              }
            },
            "required": ["type"]
          },
          "description": "Extensions detected in observed credentials' `type` arrays. The registrar agent looks each one up in the Extensions Register and additionally validates against the extension schema/vocabulary."
        },
        "counts": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "observed": {
              "type": "integer",
              "minimum": 0,
              "description": "Total credentials of this type/version observed in this cycle."
            },
            "signaturePass": { "type": "integer", "minimum": 0 },
            "signatureFail": { "type": "integer", "minimum": 0 },
            "schemaPass": {
              "type": "integer",
              "minimum": 0,
              "description": "Validated against UNTP core schema and any matched extension schemas."
            },
            "schemaFail": { "type": "integer", "minimum": 0 },
            "vocabularyPass": {
              "type": "integer",
              "minimum": 0,
              "description": "Vocabulary terms (CVC topics/metrics, etc.) resolved to known concepts."
            },
            "vocabularyFail": { "type": "integer", "minimum": 0 },
            "bindingPass": {
              "type": "integer",
              "minimum": 0,
              "description": "A vendor binding credential was retrievable and confirmed the (credentialId, softwareVersionId) pair."
            },
            "bindingFail": { "type": "integer", "minimum": 0 },
            "bindingNotApplicable": {
              "type": "integer",
              "minimum": 0,
              "description": "Vendor does not offer binding credentials, so the binding dimension was skipped."
            }
          },
          "required": ["observed"]
        },
        "overallResult": {
          "type": "string",
          "enum": ["pass", "fail", "partial"]
        },
        "evidenceSamples": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "credentialId": {
                "type": "string",
                "format": "uri"
              },
              "credentialUri": {
                "type": "string",
                "format": "uri",
                "description": "Resolvable URI returned by the IDR for this credential."
              },
              "idrQuery": {
                "type": "string",
                "format": "uri",
                "description": "The IDR query URL the registrar agent used to discover this credential."
              },
              "result": {
                "type": "string",
                "enum": ["pass", "fail"]
              },
              "failureReason": {
                "type": "string"
              }
            },
            "required": ["credentialId", "result"]
          },
          "description": "Bounded sample (typically <=10) of observed credentials, including representative failures, for audit and diagnosis."
        },
        "registrarAttestation": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": {
              "type": "string",
              "format": "uri",
              "description": "URI of the verifiable credential the registrar agent issued recording this observation."
            },
            "issuer": {
              "type": "string",
              "format": "uri",
              "description": "DID of the registrar agent (matches `registrar.agent.id` at register level)."
            },
            "issuedAt": {
              "type": "string",
              "format": "date-time"
            }
          },
          "required": ["id", "issuer"]
        }
      },
      "required": ["observedAt", "credentialType", "counts", "overallResult"]
    },
    "ObservedStatus": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "lastObservedAt": {
          "type": "string",
          "format": "date-time"
        },
        "totalCredentialsObserved": {
          "type": "integer",
          "minimum": 0
        },
        "conformantCount": {
          "type": "integer",
          "minimum": 0
        },
        "nonConformantCount": {
          "type": "integer",
          "minimum": 0
        },
        "currentAssessment": {
          "type": "string",
          "enum": ["conformant", "non-conformant", "partially-conformant", "insufficient-data"],
          "description": "Rolling assessment derived from observations within the registrar's assessment window."
        },
        "assessmentWindowDays": {
          "type": "integer",
          "minimum": 1,
          "description": "Number of days of observations the `currentAssessment` is computed over."
        }
      },
      "required": ["currentAssessment"]
    },
    "IndustryFocus": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "industrySector": { "type": "string" },
        "processFocus": { "type": "string" },
        "untpUsage": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": ["VCP", "DPP", "DTE", "DCC", "DFR", "IDR", "DIA", "DAC", "SVC"]
          }
        }
      },
      "required": ["industrySector"]
    }
  }
}
