{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://xcim.invalid/ietf/as01/schemas/material.schema.json",
  "title": "AS01-F01 material",
  "oneOf": [
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "format",
        "value"
      ],
      "properties": {
        "format": {
          "const": "as-record"
        },
        "value": {
          "oneOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "app_id",
                "app_epoch",
                "authority_epoch",
                "control_key_thumbprint"
              ],
              "properties": {
                "app_id": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/id"
                },
                "app_epoch": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/positive"
                },
                "authority_epoch": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/positive"
                },
                "control_key_thumbprint": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/hash"
                }
              }
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "owner_id",
                "kid",
                "thumbprint",
                "public_jwk",
                "alg",
                "role",
                "app_epoch",
                "authority_epoch",
                "valid_from",
                "valid_until"
              ],
              "properties": {
                "owner_id": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/id"
                },
                "kid": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/token"
                },
                "thumbprint": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/hash"
                },
                "public_jwk": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/jwk"
                },
                "alg": {
                  "enum": [
                    "Ed25519",
                    "EdDSA"
                  ]
                },
                "role": {
                  "enum": [
                    "receipt",
                    "recipient_binding",
                    "authority_attestation",
                    "legacy_receipt",
                    "legacy_batch",
                    "app_control",
                    "message_presentation"
                  ]
                },
                "app_epoch": {
                  "oneOf": [
                    {
                      "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/positive"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "authority_epoch": {
                  "oneOf": [
                    {
                      "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/positive"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "valid_from": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/nonnegative"
                },
                "valid_until": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/positive"
                }
              }
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "app_id",
                "app_epoch",
                "domain",
                "domain_epoch",
                "role",
                "observation_commitment",
                "observed_at",
                "recheck_by"
              ],
              "properties": {
                "app_id": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/id"
                },
                "app_epoch": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/positive"
                },
                "domain": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/domain"
                },
                "domain_epoch": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/positive"
                },
                "role": {
                  "enum": [
                    "organizational",
                    "rfc5322_from",
                    "dkim_signing",
                    "envelope_from",
                    "link_domain",
                    "consent_presentation_delegate"
                  ]
                },
                "observation_commitment": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/hash"
                },
                "observed_at": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/nonnegative"
                },
                "recheck_by": {
                  "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/positive"
                }
              }
            }
          ]
        }
      }
    },
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "format",
        "value"
      ],
      "properties": {
        "format": {
          "const": "p1-jws-envelope"
        },
        "value": {
          "$ref": "https://xcim.invalid/ietf/as01/schemas/common.schema.json#/$defs/jws"
        }
      }
    }
  ]
}
