{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.ishare.eu/v3/common/bitstring-status-list-credential.json",
  "title": "Verifiable Credential: Bitstring Status List Credential",
  "description": "Schema for a BitstringStatusListCredential Verifiable Credential as defined in W3C Bitstring Status List v1.0. Vocabulary defined in W3C JSON-LD context (https://www.w3.org/ns/credentials/status/v1) and specification (https://w3c.github.io/vc-bitstring-status-list/)",
  "type": "object",
  "properties": {
    "@context": {
      "type": "array",
      "minItems": 2,
      "items": [
        { "const": "https://www.w3.org/ns/credentials/v2" },
        { "const": "https://www.w3.org/ns/credentials/status/v1" }
      ],
      "description": "JSON-LD context including Verifiable Credentials v2 and Bitstring Status List vocabulary"
    },
    "type": {
      "type": "array",
      "minItems": 2,
      "items": [
        { "const": "VerifiableCredential" },
        { "const": "BitstringStatusListCredential" }
      ],
      "uniqueItems": true,
      "description": "Type array must include 'VerifiableCredential' and 'BitstringStatusListCredential'"
    },
    "id": {
      "type": "string",
      "format": "uri",
      "description": "Unique identifier for the status list credential"
    },
    "issuer": {
      "oneOf": [
        { "type": "string", "format": "uri" },
        {
          "type": "object",
          "properties": { "id": { "type": "string", "format": "uri" } },
          "required": ["id"],
          "additionalProperties": true
        }
      ],
      "description": "The issuer of the status list credential"
    },
    "validFrom": {
      "type": "string",
      "format": "date-time",
      "description": "The date and time from which the status list credential is valid"
    },
    "validUntil": {
      "type": "string",
      "format": "date-time",
      "description": "The date and time after which the status list credential is no longer valid"
    },
    "credentialSubject": {
      "$ref": "#/$defs/BitstringStatusList"
    }
  },
  "required": ["@context", "type", "issuer", "credentialSubject"],
  "additionalProperties": false,
  "$defs": {
    "BitstringStatusList": {
      "type": "object",
      "description": "The credential subject representing a bitstring status list. Vocabulary defined in https://www.w3.org/ns/credentials/status/v1",
      "properties": {
        "id": {
          "type": "string",
          "format": "uri",
          "description": "URI identifying the status list, typically includes a fragment identifier (e.g., 'https://example.com/credentials/status/3#list')"
        },
        "type": {
          "type": "string",
          "const": "BitstringStatusList",
          "description": "The type of the credential subject, must be 'BitstringStatusList'"
        },
        "statusPurpose": {
          "type": "string",
          "enum": ["revocation", "suspension", "refresh"],
          "description": "The purpose of the status list. Allowed values: 'revocation' (for revoked credentials), 'suspension' (for suspended credentials), or 'refresh' (for credentials requiring refresh). As defined in W3C Bitstring Status List v1.0"
        },
        "encodedList": {
          "type": "string",
          "description": "Multibase-encoded base64url (without padding) representation of the GZIP-compressed bitstring values for the associated range of verifiable credential status values. Each bit represents the status of one credential (1 = revoked/suspended, 0 = active)."
        },
        "ttl": {
          "type": "number",
          "minimum": 0,
          "description": "Optional time to live in milliseconds before a refresh SHOULD be attempted. This does not override the validity period of the credential itself."
        }
      },
      "required": ["id", "type", "statusPurpose", "encodedList"],
      "additionalProperties": false
    }
  }
}

