{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "title": "DTG AdmissionVouch (vouch@2, wire 0.24 family)",
 "description": "One member's vouching statement for one admission candidate as a conformant DTG EndorsementCredential (DTGWG Core Credentials WD01; Access 4.2/4.3/5.3). Endorsement vocabulary AdmissionVouch is community-defined by the Access layer: genesisDigest binds the group, accept binds the consented candidacy (no standing vouch), provenance is self-asserted. Proof: DataIntegrityProof eddsa-jcs-2022 incl. the mandatory proof @context copy.",
 "type": "object",
 "additionalProperties": false,
 "required": [
  "@context",
  "type",
  "issuer",
  "validFrom",
  "credentialSubject",
  "proof"
 ],
 "properties": {
  "@context": {
   "type": "array",
   "minItems": 3,
   "maxItems": 3,
   "prefixItems": [
    {
     "const": "https://www.w3.org/ns/credentials/v2"
    },
    {
     "const": "https://firstperson.network/credentials/dtg/v1"
    },
    {
     "const": "https://real-life.org/rltp/v1"
    }
   ],
   "items": false
  },
  "type": {
   "type": "array",
   "minItems": 4,
   "maxItems": 4,
   "allOf": [
    {
     "contains": {
      "const": "VerifiableCredential"
     }
    },
    {
     "contains": {
      "const": "DTGCredential"
     }
    },
    {
     "contains": {
      "const": "EndorsementCredential"
     }
    },
    {
     "contains": {
      "const": "AdmissionVouch"
     }
    }
   ]
  },
  "issuer": {
   "type": "string",
   "pattern": "^did:key:z6Mk[1-9A-HJ-NP-Za-km-z]{44}$"
  },
  "validFrom": {
   "type": "string",
   "maxLength": 24,
   "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]{1,3})?Z$",
   "description": "RFC3339 UTC 'Z', at most 3 fractional-second digits, 24 characters maximum — the Encounter 2.3 securing profile's timestamp language, shared verbatim by all three RLTP credential schemas: a syntactic gate, calendar validity is a parse-time check."
  },
  "credentialSubject": {
   "type": "object",
   "additionalProperties": false,
   "required": [
    "id",
    "endorsement"
   ],
   "properties": {
    "id": {
     "type": "string",
     "pattern": "^did:key:z6Mk[1-9A-HJ-NP-Za-km-z]{44}$"
    },
    "endorsement": {
     "type": "object",
     "additionalProperties": false,
     "required": [
      "type",
      "genesisDigest",
      "accept",
      "provenance"
     ],
     "properties": {
      "type": {
       "const": "AdmissionVouch"
      },
      "genesisDigest": {
       "type": "string",
       "pattern": "^(u[A-Za-z0-9_-]{45}[AQgw]|z[1-9A-HJ-NP-Za-km-z]{44,48})$",
       "description": "multibase(multihash sha2-256) per Encounter 2.3: emit u, accept u/z; algorithm and length are checked at parse"
      },
      "accept": {
       "type": "string",
       "pattern": "^(u[A-Za-z0-9_-]{45}[AQgw]|z[1-9A-HJ-NP-Za-km-z]{44,48})$",
       "description": "multibase(multihash sha2-256) per Encounter 2.3: emit u, accept u/z; algorithm and length are checked at parse"
      },
      "provenance": {
       "enum": [
        "met",
        "introduced"
       ]
      }
     }
    }
   }
  },
  "proof": {
   "type": "object",
   "additionalProperties": false,
   "required": [
    "type",
    "cryptosuite",
    "created",
    "verificationMethod",
    "proofPurpose",
    "proofValue",
    "@context"
   ],
   "properties": {
    "type": {
     "const": "DataIntegrityProof"
    },
    "cryptosuite": {
     "const": "eddsa-jcs-2022"
    },
    "created": {
     "type": "string",
     "maxLength": 24,
     "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\.[0-9]{1,3})?Z$",
     "description": "RFC3339 UTC 'Z', at most 3 fractional-second digits, 24 characters maximum — the Encounter 2.3 securing profile's timestamp language, shared verbatim by all three RLTP credential schemas: a syntactic gate, calendar validity is a parse-time check."
    },
    "verificationMethod": {
     "type": "string",
     "pattern": "^did:key:z6Mk[1-9A-HJ-NP-Za-km-z]{44}#z6Mk[1-9A-HJ-NP-Za-km-z]{44}$"
    },
    "proofPurpose": {
     "const": "assertionMethod"
    },
    "proofValue": {
     "type": "string",
     "minLength": 65,
     "maxLength": 89,
     "pattern": "^z[1-9A-HJ-NP-Za-km-z]+$",
     "description": "multibase base58btc of an Ed25519 signature (exactly 64 bytes): 'z' plus 64 to 88 base58 characters — the Encounter 2.3 form, shared verbatim by all three RLTP credential schemas."
    },
    "@context": {
     "type": "array",
     "minItems": 3,
     "maxItems": 3,
     "prefixItems": [
      {
       "const": "https://www.w3.org/ns/credentials/v2"
      },
      {
       "const": "https://firstperson.network/credentials/dtg/v1"
      },
      {
       "const": "https://real-life.org/rltp/v1"
      }
     ],
     "items": false
    }
   }
  }
 }
}