{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.ishare.eu/v3/common/credential-status.json",
  "title": "Verifiable Credential Status (BitstringStatusListEntry)",
  "description": "Shared schema definition for credentialStatus using bitstring status lists. 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/)",
  "$defs": {
    "BitstringStatusListEntry": {
      "type": "object",
      "description": "Credential status entry for bitstring status lists. Vocabulary defined in https://www.w3.org/ns/credentials/status/v1",
      "properties": {
        "id": {
          "type": "string",
          "format": "uri",
          "description": "A URL identifying the status entry. Typically includes the status list credential URL and the index as a fragment (e.g., 'https://example.com/credentials/status/3#94567')"
        },
        "type": {
          "type": "string",
          "const": "BitstringStatusListEntry",
          "description": "The type of status entry, must be 'BitstringStatusListEntry' as defined in W3C Bitstring Status List v1.0"
        },
        "statusPurpose": {
          "type": "string",
          "enum": ["revocation", "suspension", "refresh"],
          "description": "The purpose of the status entry. 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"
        },
        "statusListIndex": {
          "type": "string",
          "pattern": "^[0-9]+$",
          "description": "The zero-based index value of the bit position in the status list bitstring that represents the status of this credential"
        },
        "statusListCredential": {
          "type": "string",
          "format": "uri",
          "description": "A URL identifying the status list credential that contains the bitstring"
        },
        "statusMessage": {
          "type": "object",
          "description": "Optional status message providing additional information about the credential status",
          "properties": {
            "id": {
              "type": "string",
              "format": "uri",
              "description": "Optional identifier for the status message"
            },
            "type": {
              "type": "string",
              "description": "Optional type of the status message"
            },
            "message": {
              "type": "string",
              "description": "Human-readable message describing the status"
            },
            "status": {
              "type": "string",
              "description": "Status value or code"
            }
          },
          "additionalProperties": false
        },
        "statusReference": {
          "type": "string",
          "format": "uri",
          "description": "Optional reference to additional status information or resources"
        },
        "statusSize": {
          "type": "integer",
          "description": "Optional size of the status list in bits",
          "minimum": 0
        }
      },
      "required": ["id", "type", "statusPurpose", "statusListIndex", "statusListCredential"],
      "additionalProperties": false
    },
    "CredentialStatus": {
      "description": "The credentialStatus property of a Verifiable Credential using bitstring status lists. Can be a single status entry or an array of status entries to support multiple status purposes.",
      "oneOf": [
        { "$ref": "#/$defs/BitstringStatusListEntry" },
        {
          "type": "array",
          "items": { "$ref": "#/$defs/BitstringStatusListEntry" },
          "minItems": 1,
          "description": "Array of status entries, allowing a credential to have multiple status purposes (e.g., both revocation and suspension)"
        }
      ]
    }
  }
}

