{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.ishare.eu/v3/party/claims/dataspace-role/schema.json",
  "title": "Verifiable Credential: iSHARE Dataspace Role Claim",
  "description": "Verifiable Credential envelope for an iSHARE Dataspace Role 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/dataspace-role/context.jsonld" }
      ]
    },
    "type": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "items": [
        { "const": "VerifiableCredential" },
        { "const": "DataspaceRoleCredential" }
      ]
    },
    "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/DataspaceRoleClaimSubject" }
  },
  "required": ["@context", "type", "issuer", "credentialStatus", "credentialSubject"],
  "additionalProperties": false,
  "$defs": {
    "DataspaceRoleClaimSubject": {
      "type": "object",
      "properties": {
        "id": { "type": "string" },
        "type": { "type": "string", "const": "dataspaceRole" },
        "registrarId": { "type": "string" },
        "dataspaceId": { 
          "type": "string",
          "description": "ID of the dataspace",
          "example": "DSP.EU.NL.DutchMobility"
        },
        "roleId": { 
          "type": "string",
          "description": "Name of the role as defined by the framework or dataspace.",
          "example": "ServiceConsumer"
        },
        "title": { 
          "type": "string",
          "description": "Title of the role.",
          "example": "Service Consumer"
        },
        "loa": { 
          "type": "string",
          "enum": ["low", "substantial", "high"],
          "description": "Party's level of assurance"
        },
        "compliancyVerified": { 
          "type": "string",
          "enum": ["yes", "no", "not-applicable"],
          "description": "Compliance requirements of this role has been met by party"
        },
        "legalAdherence": { 
          "type": "string",
          "enum": ["yes", "no", "not-applicable"],
          "description": "Legal requirements of this role has been met by party"
        }
      },
      "required": ["id", "type", "registrarId", "roleId", "loa", "compliancyVerified", "legalAdherence", "dataspaceId"],
      "additionalProperties": false
    }
  }
}

