{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://schemas.ishare.eu/v3/party/claims/framework-agreement/schema.json",
  "title": "Verifiable Credential: iSHARE Framework Agreement Claim",
  "description": "Verifiable Credential envelope for an iSHARE Framework Agreement 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/framework-agreement/context.jsonld" }
      ]
    },
    "type": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "items": [
        { "const": "VerifiableCredential" },
        { "const": "FrameworkAgreementCredential" }
      ]
    },
    "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/FrameworkAgreementClaimSubject" }
  },
  "required": ["@context", "type", "issuer", "credentialStatus", "credentialSubject"],
  "additionalProperties": false,
  "$defs": {
    "FrameworkAgreementClaimSubject": {
      "type": "object",
      "properties": {
        "id": { "type": "string" },
        "type": { "type": "string", "const": "frameworkAgreement" },
        "registrarId": { "type": "string" },
        "frameworkId": { 
          "type": "string",
          "description": "ID of the framework",
          "example": "iSHARE"
        },
        "agreementType": { 
          "type": "string",
          "description": "Descriptive type of the agreement. Framework or dataspace may define agreement types.",
          "example": "Terms of Use"
        },
        "agreementId": { 
          "type": "string",
          "description": "ID that refers to the agreement.",
          "example": "dmtou"
        },
        "title": { 
          "type": "string",
          "description": "The name of the agreement or agreement file",
          "example": "terms-of-use"
        },
        "verificationHash": { 
          "type": "string",
          "description": "The calculated hash of the agreement file that has been uploaded. Note agreements are not stored in the ledger, but only their hash. The verificationHash must be calculated using the SHA256 hashing algorithm.",
          "example": "aef5bb5e3ab49150a53b89628ab8593315b6686f3f96497277feb9d658527acb"
        }
      },
      "required": ["id", "type", "registrarId", "agreementType", "agreementId", "title", "frameworkId"],
      "additionalProperties": false
    }
  }
}

