{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.ishare.eu/v3/party/claims/auth-registry/schema.json",
  "title": "Verifiable Credential: iSHARE Auth Registry Claim",
  "description": "Verifiable Credential envelope for an iSHARE Auth Registry Claim. VC 2.0 fields at the top level; domain-specific claims under credentialSubject. This schema describes the unsigned VC envelope (without proof).",
  "type": "object",
  "properties": {
    "@context": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "items": [
        { "const": "https://www.w3.org/ns/credentials/v2" },
        { "const": "https://schemas.ishare.eu/v3/party/claims/auth-registry/context.jsonld" }
      ]
    },
    "type": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "items": [
        { "const": "VerifiableCredential" },
        { "const": "AuthRegistryCredential" }
      ]
    },
    "id": { "type": "string" },
    "issuer": {
      "oneOf": [
        { "type": "string" },
        {
          "type": "object",
          "properties": { "id": { "type": "string" } },
          "required": ["id"],
          "additionalProperties": true
        }
      ]
    },
    "validFrom": { "type": "string", "format": "date-time" },
    "validUntil": { "type": "string", "format": "date-time" },
    "credentialStatus": {
      "$ref": "https://schemas.ishare.eu/v3/common/credential-status.json#/$defs/CredentialStatus",
      "description": "Credential status for checking revocation, suspension, or refresh status using bitstring status lists (BitstringStatusListEntry) as defined in W3C Bitstring Status List v1.0"
    },
    "credentialSubject": { "$ref": "#/$defs/AuthRegistryClaimSubject" }
  },
  "required": ["@context", "type", "issuer", "credentialStatus", "credentialSubject"],
  "additionalProperties": false,
  "$defs": {
    "AuthRegistryClaimSubject": {
      "type": "object",
      "properties": {
        "id": { "type": "string" },
        "type": { "type": "string", "const": "authRegistry" },
        "registrarId": { "type": "string" },
        "dataspaceId": {
          "description": "Optional ID of the dataspace",
          "type": "string",
          "example": "DSP.EU.NL.DutchMobility"
        },
        "frameworkId": {
          "description": "Optional ID of the framework",
          "type": "string",
          "example": "iSHARE"
        },
        "serviceProviderPartyId": {
          "description": "Optional party id of the Service Provider for which this AR is selected by the Entitled Party.",
          "type": "string",
          "example": "did:ishare:EU.NL.NTRNL-12345678"
        },
        "authRegistryId": { 
          "type": "string",
          "description": "The Id of the authorisation registry provider",
          "example": "did:ishare:EU.NL.NTRNL-12345678"
        },
        "authUrl": { 
          "type": "string",
          "description": "The URL pointer specific to the party where authorisations can be queried/checked from",
          "example": "http://ar.isharetest.net/"
        },
        "name": { 
          "type": "string",
          "description": "The name of the authorisation registry provider",
          "example": "iSHARE Test Authorization Registry"
        }
      },
      "required": ["id", "type", "registrarId", "authRegistryId", "authUrl", "name"],
      "additionalProperties": false
    }
  }
}

