{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "title": "SD-JWT EuropeanDisabilityCard Schema",
    "description": "An object defining the structure of a SD-JWT Verifiable Credential EuropeanDisabilityCard",
    "type": "object",
    "required": [
        "iss",
        "sub",
        "exp",
        "issuing_authority",
        "issuing_country",
        "status",
        "cnf",
        "vct",
        "vct#integrity",
        "link_qr_code",
        "given_name",
        "family_name",
        "birth_date",
        "portrait",
        "constant_attendance_allowance",
        "expiry_date",
        "document_number"
    ],
    "properties": {
        "vct": {
            "type": "string",
            "description": "An HTTP URL string identifying the SD-JWT VC type (It MUST contain also the number of version of the SD-JWT VC type); Credential Type Metadata JSON Document of this SD-JWT VC MAY be retrieved directly from this URL, using the HTTP GET method",
            "format": "uri"
        },
        "vct#integrity": {
            "type": "string",
            "description": "A String representing an integrity metadata for ensuring the integrity of the resource referred to by the vct"
        },
        "iss": {
            "type": "string",
            "description": "URL string representing the Credential Issuer unique identifier",
            "format": "uri"
        },
        "iat": {
            "type": "number",
            "description": "UNIX Timestamp with the time of JWT issuance, coded as NumericDate as indicated in RFC 7519"
        },
        "exp": {
            "type": "number",
            "description": "UNIX Timestamp with the expiry time of the JWT, coded as NumericDate as indicated in RFC 7519"
        },
        "nbf": {
            "type": "number",
            "description": "UNIX Timestamp with the start time of validity of the JWT, coded as NumericDate as indicated in RFC 7519"
        },
        "sub": {
            "type": "string",
            "description": "Identifier of the subject of the SD-JWT",
            "pattern": "^[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}\\z$"
        },
        "issuing_authority": {
            "type": "string",
            "description": "Name of the administrative authority that has issued the SD-JWT VC",
            "pattern": "^(?!\\s)(?!.*\\s\\s)(?!.*\\s$).+$"
        },
        "issuing_country": {
            "type": "string",
            "description": "Country of the SD-JWT VC issuing authority, as a two letter country code defined in ISO 3166-1 alpha-2",
            "enum": [
                "IT"
            ]
        },
        "cnf": {
            "description": "JSON object containing the proof-of-possession key materials",
            "type": "object",
            "properties": {
                "jwk": {
                    "required": [
                        "kty",
                        "crv",
                        "x",
                        "y"
                    ],
                    "properties": {
                        "alg": {
                            "type": "string",
                            "enum": [
                                "ES256",
                                "ES384",
                                "ES512"
                            ]
                        },
                        "key_ops": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "kid": {
                            "type": "string"
                        },
                        "kty": {
                            "type": "string",
                            "enum": [
                                "EC"
                            ]
                        },
                        "use": {
                            "type": "string",
                            "enum": [
                                "sig",
                                "enc"
                            ]
                        },
                        "x5c": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        },
                        "x5t": {
                            "type": "string"
                        },
                        "x5t#S256": {
                            "type": "string"
                        },
                        "x5u": {
                            "format": "uri",
                            "type": "string"
                        },
                        "crv": {
                            "type": "string",
                            "enum": [
                                "P-256",
                                "P-384",
                                "P-512"
                            ]
                        },
                        "x": {
                            "type": "string"
                        },
                        "y": {
                            "type": "string"
                        }
                    },
                    "additionalProperties": false
                },
                "additionalProperties": false
            }
        },
        "status": {
            "type": "object",
            "description": "JSON object containing the information on how to read the status of the SD-JWT",
            "required": [
                "status_assertion"
            ],
            "properties": {
                "status_assertion": {
                    "type": "object",
                    "description": "JSON object defining the status_assertion mechanism",
                    "required": [
                        "credential_hash_alg"
                    ],
                    "properties": {
                        "credential_hash_alg": {
                            "type": "string",
                            "description": "Identifier of the hash algorithm used by the Credential Issuer for hashing the SD-JWT VC to which the Status Assertion is bound",
                            "enum": [
                                "sha-256"
                            ]
                        }
                    },
                    "additionalProperties": false
                }
            },
            "additionalProperties": false
        },
        "_sd": {
            "type": "array",
            "description": "Digests of the disclosures",
            "minItems": 1,
            "items": {
                "type": "string"
            }
        },
        "_sd_alg": {
            "type": "string",
            "description": "Identifier of the hash algorithm used by the Credential Issuer to generate the digests",
            "enum": [
                "sha-256"
            ]
        },
        "verification": {
            "type": "object",
            "description": "Object containing User authentication and User data verification information",
            "required": [
                "evidence"
            ],
            "properties": {
                "trust_framework": {
                    "type": "string",
                    "description": "The trust framework used for digital authentication towards Authentic Source system",
                    "enum": [
                        "it_l2+document_proof",
                        "it_cie",
                        "it_wallet",
                        "eudi_wallet"
                    ]
                },
                "assurance_level": {
                    "type": "string",
                    "description": "String identifying the level of identity assurance guaranteed during the User authentication process (Low=enrolment is performed by self-registration in a web-page, without any identity verification;Substantial=enrolment is performed by providing and verifying identity information, and authentication by using a user name and a password and a one-time password sent to your mobile phone;High=enrolment is performed by registering in person in an office, and authentication by using a smartcard, like a National ID Card)",
                    "enum": [
                        "high",
                        "substantial"
                    ]
                },
                "evidence": {
                    "type": "array",
                    "description": "Supported evidences of the identity verification process",
                    "minItems": 1,
                    "items": {
                        "type": "object",
                        "required": [
                            "type",
                            "time",
                            "attestation"
                        ],
                        "properties": {
                            "type": {
                                "type": "string",
                                "description": "Evidence type",
                                "enum": [
                                    "vouch"
                                ]
                            },
                            "time": {
                                "type": "number",
                                "description": "UNIX Timestamps with the time of the authentication or verification"
                            },
                            "attestation": {
                                "type": "object",
                                "description": "Object representing the attestation obtained after the authentication or verification",
                                "required": [
                                    "type",
                                    "reference_number",
                                    "date_of_issuance",
                                    "voucher"
                                ],
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "description": "Attestation type",
                                        "enum": [
                                            "digital_attestation"
                                        ]
                                    },
                                    "reference_number": {
                                        "type": "string",
                                        "description": "Identifier of the authentication or verification response"
                                    },
                                    "date_of_issuance": {
                                        "type": "string",
                                        "description": "Date of issuance of the attestation",
                                        "format": "date"
                                    },
                                    "voucher": {
                                        "type": "object",
                                        "required": [
                                            "organization"
                                        ],
                                        "properties": {
                                            "organization": {
                                                "type": "string",
                                                "description": "Name of the attestation issuer",
                                                "pattern": "^(?!\\s)(?!.*\\s\\s)(?!.*\\s$).+$"
                                            }
                                        },
                                        "additionalProperties": false
                                    }
                                },
                                "additionalProperties": false
                            },
                            "additionalProperties": false
                        }
                    }
                },
                "additionalProperties": false
            }
        },
        "link_qr_code": {
            "type": "string",
            "format": "uri",
            "description": "QR Code"
        },
        "given_name": {
            "type": "string",
            "description": "First Name"
        },
        "family_name": {
            "type": "string",
            "description": "Family Name"
        },
        "birth_date": {
            "type": "string",
            "format": "date",
            "description": "Date of birth"
        },
        "portrait": {
            "type": "string",
            "description": "Photo content in base64 encoded",
            "pattern": "^data:image\\/(png|jpeg);base64,(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"
        },
        "constant_attendance_allowance": {
            "type": "boolean",
            "description": "Constant attendance allowance"
        },
        "expiry_date": {
            "type": "string",
            "format": "date",
            "description": "Expiration date"
        },
        "document_number": {
            "type": "string",
            "description": "Document number"
        }
    },
    "additionalProperties": false
}