{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "iss": {
          "type": "string",
          "minLength": 1
        },
        "aud": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            }
          ]
        },
        "aud_type": {
          "type": "string",
          "enum": [
            "data_holder_url",
            "trust_framework"
          ]
        },
        "exp": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "iat": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "jti": {
          "type": "string",
          "minLength": 1
        },
        "presenter_binding": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "const": "jkt"
                },
                "jkt": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "method",
                "jkt"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "const": "trust_framework_client"
                },
                "trust_framework": {
                  "type": "string",
                  "minLength": 1
                },
                "framework_type": {
                  "type": "string",
                  "enum": [
                    "well-known",
                    "udap",
                    "oidf"
                  ]
                },
                "entity_uri": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "method",
                "trust_framework",
                "framework_type",
                "entity_uri"
              ],
              "additionalProperties": false
            }
          ]
        },
        "revocation": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "minLength": 1
            },
            "index": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "url",
            "index"
          ],
          "additionalProperties": false
        },
        "must_understand": {
          "minItems": 1,
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]*$"
          }
        },
        "subject": {
          "type": "object",
          "properties": {
            "patient": {
              "type": "object",
              "properties": {
                "resourceType": {
                  "type": "string",
                  "const": "Patient"
                },
                "identifier": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      },
                      "type": {
                        "type": "object",
                        "properties": {
                          "coding": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "display": {
                                  "type": "string"
                                }
                              },
                              "additionalProperties": {}
                            }
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "name": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "family": {
                        "type": "string"
                      },
                      "given": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "prefix": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "suffix": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "birthDate": {
                  "type": "string"
                },
                "gender": {
                  "type": "string"
                }
              },
              "required": [
                "resourceType"
              ],
              "additionalProperties": {}
            },
            "recipient_record": {
              "type": "object",
              "properties": {
                "reference": {
                  "type": "string"
                },
                "identifier": {
                  "type": "object",
                  "properties": {
                    "system": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    },
                    "type": {
                      "type": "object",
                      "properties": {
                        "coding": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "system": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "display": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": {}
                          }
                        },
                        "text": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": {}
                    }
                  },
                  "additionalProperties": {}
                },
                "type": {
                  "type": "string",
                  "const": "Patient"
                },
                "display": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            }
          },
          "required": [
            "patient"
          ],
          "additionalProperties": false
        },
        "requester": {
          "not": {}
        },
        "access": {
          "type": "object",
          "properties": {
            "permissions": {
              "minItems": 1,
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "data"
                      },
                      "resource_type": {
                        "type": "string",
                        "minLength": 1
                      },
                      "interactions": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "read",
                            "search",
                            "history",
                            "create",
                            "update",
                            "patch",
                            "delete"
                          ]
                        }
                      },
                      "category_any_of": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      },
                      "code_any_of": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      }
                    },
                    "required": [
                      "kind",
                      "resource_type",
                      "interactions"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "operation"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "target": {
                        "type": "object",
                        "properties": {
                          "reference": {
                            "type": "string"
                          },
                          "identifier": {
                            "type": "object",
                            "properties": {
                              "system": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              },
                              "type": {
                                "type": "object",
                                "properties": {
                                  "coding": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "system": {
                                          "type": "string"
                                        },
                                        "code": {
                                          "type": "string"
                                        },
                                        "display": {
                                          "type": "string"
                                        }
                                      },
                                      "additionalProperties": {}
                                    }
                                  },
                                  "text": {
                                    "type": "string"
                                  }
                                },
                                "additionalProperties": {}
                              }
                            },
                            "additionalProperties": {}
                          },
                          "type": {
                            "type": "string"
                          },
                          "display": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "kind",
                      "name"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "data_period": {
              "type": "object",
              "properties": {
                "start": {
                  "type": "string"
                },
                "end": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            },
            "data_holder_filter": {
              "minItems": 1,
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "jurisdiction"
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "country": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "kind",
                      "address"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "organization"
                      },
                      "organization": {
                        "type": "object",
                        "properties": {
                          "resourceType": {
                            "type": "string",
                            "const": "Organization"
                          },
                          "name": {
                            "type": "string"
                          },
                          "identifier": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "object",
                                  "properties": {
                                    "coding": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "system": {
                                            "type": "string"
                                          },
                                          "code": {
                                            "type": "string"
                                          },
                                          "display": {
                                            "type": "string"
                                          }
                                        },
                                        "additionalProperties": {}
                                      }
                                    },
                                    "text": {
                                      "type": "string"
                                    }
                                  },
                                  "additionalProperties": {}
                                }
                              },
                              "additionalProperties": {}
                            }
                          }
                        },
                        "required": [
                          "resourceType"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "kind",
                      "organization"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "sensitive_data": {
              "type": "string",
              "enum": [
                "exclude",
                "include"
              ]
            }
          },
          "required": [
            "permissions"
          ],
          "additionalProperties": false
        },
        "ticket_type": {
          "type": "string",
          "const": "https://smarthealthit.org/permission-ticket-type/patient-self-access-v1"
        },
        "context": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        }
      },
      "required": [
        "iss",
        "aud",
        "exp",
        "jti",
        "subject",
        "access",
        "ticket_type"
      ],
      "additionalProperties": {}
    },
    {
      "type": "object",
      "properties": {
        "iss": {
          "type": "string",
          "minLength": 1
        },
        "aud": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            }
          ]
        },
        "aud_type": {
          "type": "string",
          "enum": [
            "data_holder_url",
            "trust_framework"
          ]
        },
        "exp": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "iat": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "jti": {
          "type": "string",
          "minLength": 1
        },
        "presenter_binding": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "const": "jkt"
                },
                "jkt": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "method",
                "jkt"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "const": "trust_framework_client"
                },
                "trust_framework": {
                  "type": "string",
                  "minLength": 1
                },
                "framework_type": {
                  "type": "string",
                  "enum": [
                    "well-known",
                    "udap",
                    "oidf"
                  ]
                },
                "entity_uri": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "method",
                "trust_framework",
                "framework_type",
                "entity_uri"
              ],
              "additionalProperties": false
            }
          ]
        },
        "revocation": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "minLength": 1
            },
            "index": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "url",
            "index"
          ],
          "additionalProperties": false
        },
        "must_understand": {
          "minItems": 1,
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]*$"
          }
        },
        "subject": {
          "type": "object",
          "properties": {
            "patient": {
              "type": "object",
              "properties": {
                "resourceType": {
                  "type": "string",
                  "const": "Patient"
                },
                "identifier": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      },
                      "type": {
                        "type": "object",
                        "properties": {
                          "coding": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "display": {
                                  "type": "string"
                                }
                              },
                              "additionalProperties": {}
                            }
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "name": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "family": {
                        "type": "string"
                      },
                      "given": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "prefix": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "suffix": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "birthDate": {
                  "type": "string"
                },
                "gender": {
                  "type": "string"
                }
              },
              "required": [
                "resourceType"
              ],
              "additionalProperties": {}
            },
            "recipient_record": {
              "type": "object",
              "properties": {
                "reference": {
                  "type": "string"
                },
                "identifier": {
                  "type": "object",
                  "properties": {
                    "system": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    },
                    "type": {
                      "type": "object",
                      "properties": {
                        "coding": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "system": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "display": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": {}
                          }
                        },
                        "text": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": {}
                    }
                  },
                  "additionalProperties": {}
                },
                "type": {
                  "type": "string",
                  "const": "Patient"
                },
                "display": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            }
          },
          "required": [
            "patient"
          ],
          "additionalProperties": false
        },
        "requester": {
          "type": "object",
          "properties": {
            "resourceType": {
              "type": "string",
              "const": "RelatedPerson"
            },
            "relationship": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "coding": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "system": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "display": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": {}
                    }
                  },
                  "text": {
                    "type": "string"
                  }
                },
                "additionalProperties": {}
              }
            },
            "name": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "family": {
                    "type": "string"
                  },
                  "given": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "prefix": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "suffix": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "additionalProperties": {}
              }
            },
            "identifier": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "system": {
                    "type": "string"
                  },
                  "value": {
                    "type": "string"
                  },
                  "type": {
                    "type": "object",
                    "properties": {
                      "coding": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "additionalProperties": {}
              }
            }
          },
          "required": [
            "resourceType"
          ],
          "additionalProperties": {}
        },
        "access": {
          "type": "object",
          "properties": {
            "permissions": {
              "minItems": 1,
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "data"
                      },
                      "resource_type": {
                        "type": "string",
                        "minLength": 1
                      },
                      "interactions": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "read",
                            "search",
                            "history",
                            "create",
                            "update",
                            "patch",
                            "delete"
                          ]
                        }
                      },
                      "category_any_of": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      },
                      "code_any_of": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      }
                    },
                    "required": [
                      "kind",
                      "resource_type",
                      "interactions"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "operation"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "target": {
                        "type": "object",
                        "properties": {
                          "reference": {
                            "type": "string"
                          },
                          "identifier": {
                            "type": "object",
                            "properties": {
                              "system": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              },
                              "type": {
                                "type": "object",
                                "properties": {
                                  "coding": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "system": {
                                          "type": "string"
                                        },
                                        "code": {
                                          "type": "string"
                                        },
                                        "display": {
                                          "type": "string"
                                        }
                                      },
                                      "additionalProperties": {}
                                    }
                                  },
                                  "text": {
                                    "type": "string"
                                  }
                                },
                                "additionalProperties": {}
                              }
                            },
                            "additionalProperties": {}
                          },
                          "type": {
                            "type": "string"
                          },
                          "display": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "kind",
                      "name"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "data_period": {
              "type": "object",
              "properties": {
                "start": {
                  "type": "string"
                },
                "end": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            },
            "data_holder_filter": {
              "minItems": 1,
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "jurisdiction"
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "country": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "kind",
                      "address"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "organization"
                      },
                      "organization": {
                        "type": "object",
                        "properties": {
                          "resourceType": {
                            "type": "string",
                            "const": "Organization"
                          },
                          "name": {
                            "type": "string"
                          },
                          "identifier": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "object",
                                  "properties": {
                                    "coding": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "system": {
                                            "type": "string"
                                          },
                                          "code": {
                                            "type": "string"
                                          },
                                          "display": {
                                            "type": "string"
                                          }
                                        },
                                        "additionalProperties": {}
                                      }
                                    },
                                    "text": {
                                      "type": "string"
                                    }
                                  },
                                  "additionalProperties": {}
                                }
                              },
                              "additionalProperties": {}
                            }
                          }
                        },
                        "required": [
                          "resourceType"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "kind",
                      "organization"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "sensitive_data": {
              "type": "string",
              "enum": [
                "exclude",
                "include"
              ]
            }
          },
          "required": [
            "permissions"
          ],
          "additionalProperties": false
        },
        "ticket_type": {
          "type": "string",
          "const": "https://smarthealthit.org/permission-ticket-type/patient-delegated-access-v1"
        },
        "context": {
          "type": "object",
          "properties": {},
          "additionalProperties": false
        }
      },
      "required": [
        "iss",
        "aud",
        "exp",
        "jti",
        "subject",
        "requester",
        "access",
        "ticket_type"
      ],
      "additionalProperties": {}
    },
    {
      "type": "object",
      "properties": {
        "iss": {
          "type": "string",
          "minLength": 1
        },
        "aud": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            }
          ]
        },
        "aud_type": {
          "type": "string",
          "enum": [
            "data_holder_url",
            "trust_framework"
          ]
        },
        "exp": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "iat": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "jti": {
          "type": "string",
          "minLength": 1
        },
        "presenter_binding": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "const": "jkt"
                },
                "jkt": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "method",
                "jkt"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "const": "trust_framework_client"
                },
                "trust_framework": {
                  "type": "string",
                  "minLength": 1
                },
                "framework_type": {
                  "type": "string",
                  "enum": [
                    "well-known",
                    "udap",
                    "oidf"
                  ]
                },
                "entity_uri": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "method",
                "trust_framework",
                "framework_type",
                "entity_uri"
              ],
              "additionalProperties": false
            }
          ]
        },
        "revocation": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "minLength": 1
            },
            "index": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "url",
            "index"
          ],
          "additionalProperties": false
        },
        "must_understand": {
          "minItems": 1,
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]*$"
          }
        },
        "subject": {
          "type": "object",
          "properties": {
            "patient": {
              "type": "object",
              "properties": {
                "resourceType": {
                  "type": "string",
                  "const": "Patient"
                },
                "identifier": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      },
                      "type": {
                        "type": "object",
                        "properties": {
                          "coding": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "display": {
                                  "type": "string"
                                }
                              },
                              "additionalProperties": {}
                            }
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "name": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "family": {
                        "type": "string"
                      },
                      "given": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "prefix": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "suffix": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "birthDate": {
                  "type": "string"
                },
                "gender": {
                  "type": "string"
                }
              },
              "required": [
                "resourceType"
              ],
              "additionalProperties": {}
            },
            "recipient_record": {
              "type": "object",
              "properties": {
                "reference": {
                  "type": "string"
                },
                "identifier": {
                  "type": "object",
                  "properties": {
                    "system": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    },
                    "type": {
                      "type": "object",
                      "properties": {
                        "coding": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "system": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "display": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": {}
                          }
                        },
                        "text": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": {}
                    }
                  },
                  "additionalProperties": {}
                },
                "type": {
                  "type": "string",
                  "const": "Patient"
                },
                "display": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            }
          },
          "required": [
            "patient"
          ],
          "additionalProperties": false
        },
        "requester": {
          "type": "object",
          "properties": {
            "resourceType": {
              "type": "string",
              "const": "Organization"
            },
            "name": {
              "type": "string"
            },
            "identifier": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "system": {
                    "type": "string"
                  },
                  "value": {
                    "type": "string"
                  },
                  "type": {
                    "type": "object",
                    "properties": {
                      "coding": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "additionalProperties": {}
              }
            }
          },
          "required": [
            "resourceType"
          ],
          "additionalProperties": {}
        },
        "access": {
          "type": "object",
          "properties": {
            "permissions": {
              "minItems": 1,
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "data"
                      },
                      "resource_type": {
                        "type": "string",
                        "minLength": 1
                      },
                      "interactions": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "read",
                            "search",
                            "history",
                            "create",
                            "update",
                            "patch",
                            "delete"
                          ]
                        }
                      },
                      "category_any_of": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      },
                      "code_any_of": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      }
                    },
                    "required": [
                      "kind",
                      "resource_type",
                      "interactions"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "operation"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "target": {
                        "type": "object",
                        "properties": {
                          "reference": {
                            "type": "string"
                          },
                          "identifier": {
                            "type": "object",
                            "properties": {
                              "system": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              },
                              "type": {
                                "type": "object",
                                "properties": {
                                  "coding": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "system": {
                                          "type": "string"
                                        },
                                        "code": {
                                          "type": "string"
                                        },
                                        "display": {
                                          "type": "string"
                                        }
                                      },
                                      "additionalProperties": {}
                                    }
                                  },
                                  "text": {
                                    "type": "string"
                                  }
                                },
                                "additionalProperties": {}
                              }
                            },
                            "additionalProperties": {}
                          },
                          "type": {
                            "type": "string"
                          },
                          "display": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "kind",
                      "name"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "data_period": {
              "type": "object",
              "properties": {
                "start": {
                  "type": "string"
                },
                "end": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            },
            "data_holder_filter": {
              "minItems": 1,
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "jurisdiction"
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "country": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "kind",
                      "address"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "organization"
                      },
                      "organization": {
                        "type": "object",
                        "properties": {
                          "resourceType": {
                            "type": "string",
                            "const": "Organization"
                          },
                          "name": {
                            "type": "string"
                          },
                          "identifier": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "object",
                                  "properties": {
                                    "coding": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "system": {
                                            "type": "string"
                                          },
                                          "code": {
                                            "type": "string"
                                          },
                                          "display": {
                                            "type": "string"
                                          }
                                        },
                                        "additionalProperties": {}
                                      }
                                    },
                                    "text": {
                                      "type": "string"
                                    }
                                  },
                                  "additionalProperties": {}
                                }
                              },
                              "additionalProperties": {}
                            }
                          }
                        },
                        "required": [
                          "resourceType"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "kind",
                      "organization"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "sensitive_data": {
              "type": "string",
              "enum": [
                "exclude",
                "include"
              ]
            }
          },
          "required": [
            "permissions"
          ],
          "additionalProperties": false
        },
        "ticket_type": {
          "type": "string",
          "const": "https://smarthealthit.org/permission-ticket-type/public-health-investigation-v1"
        },
        "context": {
          "type": "object",
          "properties": {
            "reportable_condition": {
              "type": "object",
              "properties": {
                "coding": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string"
                      },
                      "code": {
                        "type": "string"
                      },
                      "display": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "text": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            }
          },
          "required": [
            "reportable_condition"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "iss",
        "aud",
        "exp",
        "jti",
        "subject",
        "requester",
        "access",
        "ticket_type",
        "context"
      ],
      "additionalProperties": {}
    },
    {
      "type": "object",
      "properties": {
        "iss": {
          "type": "string",
          "minLength": 1
        },
        "aud": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            }
          ]
        },
        "aud_type": {
          "type": "string",
          "enum": [
            "data_holder_url",
            "trust_framework"
          ]
        },
        "exp": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "iat": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "jti": {
          "type": "string",
          "minLength": 1
        },
        "presenter_binding": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "const": "jkt"
                },
                "jkt": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "method",
                "jkt"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "const": "trust_framework_client"
                },
                "trust_framework": {
                  "type": "string",
                  "minLength": 1
                },
                "framework_type": {
                  "type": "string",
                  "enum": [
                    "well-known",
                    "udap",
                    "oidf"
                  ]
                },
                "entity_uri": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "method",
                "trust_framework",
                "framework_type",
                "entity_uri"
              ],
              "additionalProperties": false
            }
          ]
        },
        "revocation": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "minLength": 1
            },
            "index": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "url",
            "index"
          ],
          "additionalProperties": false
        },
        "must_understand": {
          "minItems": 1,
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]*$"
          }
        },
        "subject": {
          "type": "object",
          "properties": {
            "patient": {
              "type": "object",
              "properties": {
                "resourceType": {
                  "type": "string",
                  "const": "Patient"
                },
                "identifier": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      },
                      "type": {
                        "type": "object",
                        "properties": {
                          "coding": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "display": {
                                  "type": "string"
                                }
                              },
                              "additionalProperties": {}
                            }
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "name": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "family": {
                        "type": "string"
                      },
                      "given": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "prefix": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "suffix": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "birthDate": {
                  "type": "string"
                },
                "gender": {
                  "type": "string"
                }
              },
              "required": [
                "resourceType"
              ],
              "additionalProperties": {}
            },
            "recipient_record": {
              "type": "object",
              "properties": {
                "reference": {
                  "type": "string"
                },
                "identifier": {
                  "type": "object",
                  "properties": {
                    "system": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    },
                    "type": {
                      "type": "object",
                      "properties": {
                        "coding": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "system": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "display": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": {}
                          }
                        },
                        "text": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": {}
                    }
                  },
                  "additionalProperties": {}
                },
                "type": {
                  "type": "string",
                  "const": "Patient"
                },
                "display": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            }
          },
          "required": [
            "patient"
          ],
          "additionalProperties": false
        },
        "requester": {
          "type": "object",
          "properties": {
            "resourceType": {
              "type": "string",
              "const": "Organization"
            },
            "name": {
              "type": "string"
            },
            "identifier": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "system": {
                    "type": "string"
                  },
                  "value": {
                    "type": "string"
                  },
                  "type": {
                    "type": "object",
                    "properties": {
                      "coding": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "additionalProperties": {}
              }
            }
          },
          "required": [
            "resourceType"
          ],
          "additionalProperties": {}
        },
        "access": {
          "type": "object",
          "properties": {
            "permissions": {
              "minItems": 1,
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "data"
                      },
                      "resource_type": {
                        "type": "string",
                        "minLength": 1
                      },
                      "interactions": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "read",
                            "search",
                            "history",
                            "create",
                            "update",
                            "patch",
                            "delete"
                          ]
                        }
                      },
                      "category_any_of": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      },
                      "code_any_of": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      }
                    },
                    "required": [
                      "kind",
                      "resource_type",
                      "interactions"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "operation"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "target": {
                        "type": "object",
                        "properties": {
                          "reference": {
                            "type": "string"
                          },
                          "identifier": {
                            "type": "object",
                            "properties": {
                              "system": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              },
                              "type": {
                                "type": "object",
                                "properties": {
                                  "coding": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "system": {
                                          "type": "string"
                                        },
                                        "code": {
                                          "type": "string"
                                        },
                                        "display": {
                                          "type": "string"
                                        }
                                      },
                                      "additionalProperties": {}
                                    }
                                  },
                                  "text": {
                                    "type": "string"
                                  }
                                },
                                "additionalProperties": {}
                              }
                            },
                            "additionalProperties": {}
                          },
                          "type": {
                            "type": "string"
                          },
                          "display": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "kind",
                      "name"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "data_period": {
              "type": "object",
              "properties": {
                "start": {
                  "type": "string"
                },
                "end": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            },
            "data_holder_filter": {
              "minItems": 1,
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "jurisdiction"
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "country": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "kind",
                      "address"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "organization"
                      },
                      "organization": {
                        "type": "object",
                        "properties": {
                          "resourceType": {
                            "type": "string",
                            "const": "Organization"
                          },
                          "name": {
                            "type": "string"
                          },
                          "identifier": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "object",
                                  "properties": {
                                    "coding": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "system": {
                                            "type": "string"
                                          },
                                          "code": {
                                            "type": "string"
                                          },
                                          "display": {
                                            "type": "string"
                                          }
                                        },
                                        "additionalProperties": {}
                                      }
                                    },
                                    "text": {
                                      "type": "string"
                                    }
                                  },
                                  "additionalProperties": {}
                                }
                              },
                              "additionalProperties": {}
                            }
                          }
                        },
                        "required": [
                          "resourceType"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "kind",
                      "organization"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "sensitive_data": {
              "type": "string",
              "enum": [
                "exclude",
                "include"
              ]
            }
          },
          "required": [
            "permissions"
          ],
          "additionalProperties": false
        },
        "ticket_type": {
          "type": "string",
          "const": "https://smarthealthit.org/permission-ticket-type/social-care-referral-v1"
        },
        "context": {
          "type": "object",
          "properties": {
            "concern": {
              "type": "object",
              "properties": {
                "coding": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string"
                      },
                      "code": {
                        "type": "string"
                      },
                      "display": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "text": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            },
            "referral": {
              "type": "object",
              "properties": {
                "resourceType": {
                  "type": "string",
                  "const": "ServiceRequest"
                },
                "identifier": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      },
                      "type": {
                        "type": "object",
                        "properties": {
                          "coding": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "display": {
                                  "type": "string"
                                }
                              },
                              "additionalProperties": {}
                            }
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "status": {
                  "type": "string",
                  "minLength": 1
                },
                "intent": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "resourceType",
                "status",
                "intent"
              ],
              "additionalProperties": {}
            }
          },
          "required": [
            "concern",
            "referral"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "iss",
        "aud",
        "exp",
        "jti",
        "subject",
        "requester",
        "access",
        "ticket_type",
        "context"
      ],
      "additionalProperties": {}
    },
    {
      "type": "object",
      "properties": {
        "iss": {
          "type": "string",
          "minLength": 1
        },
        "aud": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            }
          ]
        },
        "aud_type": {
          "type": "string",
          "enum": [
            "data_holder_url",
            "trust_framework"
          ]
        },
        "exp": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "iat": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "jti": {
          "type": "string",
          "minLength": 1
        },
        "presenter_binding": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "const": "jkt"
                },
                "jkt": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "method",
                "jkt"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "const": "trust_framework_client"
                },
                "trust_framework": {
                  "type": "string",
                  "minLength": 1
                },
                "framework_type": {
                  "type": "string",
                  "enum": [
                    "well-known",
                    "udap",
                    "oidf"
                  ]
                },
                "entity_uri": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "method",
                "trust_framework",
                "framework_type",
                "entity_uri"
              ],
              "additionalProperties": false
            }
          ]
        },
        "revocation": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "minLength": 1
            },
            "index": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "url",
            "index"
          ],
          "additionalProperties": false
        },
        "must_understand": {
          "minItems": 1,
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]*$"
          }
        },
        "subject": {
          "type": "object",
          "properties": {
            "patient": {
              "type": "object",
              "properties": {
                "resourceType": {
                  "type": "string",
                  "const": "Patient"
                },
                "identifier": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      },
                      "type": {
                        "type": "object",
                        "properties": {
                          "coding": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "display": {
                                  "type": "string"
                                }
                              },
                              "additionalProperties": {}
                            }
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "name": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "family": {
                        "type": "string"
                      },
                      "given": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "prefix": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "suffix": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "birthDate": {
                  "type": "string"
                },
                "gender": {
                  "type": "string"
                }
              },
              "required": [
                "resourceType"
              ],
              "additionalProperties": {}
            },
            "recipient_record": {
              "type": "object",
              "properties": {
                "reference": {
                  "type": "string"
                },
                "identifier": {
                  "type": "object",
                  "properties": {
                    "system": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    },
                    "type": {
                      "type": "object",
                      "properties": {
                        "coding": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "system": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "display": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": {}
                          }
                        },
                        "text": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": {}
                    }
                  },
                  "additionalProperties": {}
                },
                "type": {
                  "type": "string",
                  "const": "Patient"
                },
                "display": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            }
          },
          "required": [
            "patient"
          ],
          "additionalProperties": false
        },
        "requester": {
          "type": "object",
          "properties": {
            "resourceType": {
              "type": "string",
              "const": "Organization"
            },
            "name": {
              "type": "string"
            },
            "identifier": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "system": {
                    "type": "string"
                  },
                  "value": {
                    "type": "string"
                  },
                  "type": {
                    "type": "object",
                    "properties": {
                      "coding": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "additionalProperties": {}
              }
            }
          },
          "required": [
            "resourceType"
          ],
          "additionalProperties": {}
        },
        "access": {
          "type": "object",
          "properties": {
            "permissions": {
              "minItems": 1,
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "data"
                      },
                      "resource_type": {
                        "type": "string",
                        "minLength": 1
                      },
                      "interactions": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "read",
                            "search",
                            "history",
                            "create",
                            "update",
                            "patch",
                            "delete"
                          ]
                        }
                      },
                      "category_any_of": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      },
                      "code_any_of": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      }
                    },
                    "required": [
                      "kind",
                      "resource_type",
                      "interactions"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "operation"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "target": {
                        "type": "object",
                        "properties": {
                          "reference": {
                            "type": "string"
                          },
                          "identifier": {
                            "type": "object",
                            "properties": {
                              "system": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              },
                              "type": {
                                "type": "object",
                                "properties": {
                                  "coding": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "system": {
                                          "type": "string"
                                        },
                                        "code": {
                                          "type": "string"
                                        },
                                        "display": {
                                          "type": "string"
                                        }
                                      },
                                      "additionalProperties": {}
                                    }
                                  },
                                  "text": {
                                    "type": "string"
                                  }
                                },
                                "additionalProperties": {}
                              }
                            },
                            "additionalProperties": {}
                          },
                          "type": {
                            "type": "string"
                          },
                          "display": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "kind",
                      "name"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "data_period": {
              "type": "object",
              "properties": {
                "start": {
                  "type": "string"
                },
                "end": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            },
            "data_holder_filter": {
              "minItems": 1,
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "jurisdiction"
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "country": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "kind",
                      "address"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "organization"
                      },
                      "organization": {
                        "type": "object",
                        "properties": {
                          "resourceType": {
                            "type": "string",
                            "const": "Organization"
                          },
                          "name": {
                            "type": "string"
                          },
                          "identifier": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "object",
                                  "properties": {
                                    "coding": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "system": {
                                            "type": "string"
                                          },
                                          "code": {
                                            "type": "string"
                                          },
                                          "display": {
                                            "type": "string"
                                          }
                                        },
                                        "additionalProperties": {}
                                      }
                                    },
                                    "text": {
                                      "type": "string"
                                    }
                                  },
                                  "additionalProperties": {}
                                }
                              },
                              "additionalProperties": {}
                            }
                          }
                        },
                        "required": [
                          "resourceType"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "kind",
                      "organization"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "sensitive_data": {
              "type": "string",
              "enum": [
                "exclude",
                "include"
              ]
            }
          },
          "required": [
            "permissions"
          ],
          "additionalProperties": false
        },
        "ticket_type": {
          "type": "string",
          "const": "https://smarthealthit.org/permission-ticket-type/payer-claims-adjudication-v1"
        },
        "context": {
          "type": "object",
          "properties": {
            "service": {
              "type": "object",
              "properties": {
                "coding": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string"
                      },
                      "code": {
                        "type": "string"
                      },
                      "display": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "text": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            },
            "claim": {
              "type": "object",
              "properties": {
                "resourceType": {
                  "type": "string",
                  "const": "Claim"
                },
                "identifier": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      },
                      "type": {
                        "type": "object",
                        "properties": {
                          "coding": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "display": {
                                  "type": "string"
                                }
                              },
                              "additionalProperties": {}
                            }
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "status": {
                  "type": "string",
                  "minLength": 1
                },
                "use": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "resourceType",
                "status",
                "use"
              ],
              "additionalProperties": {}
            }
          },
          "required": [
            "service",
            "claim"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "iss",
        "aud",
        "exp",
        "jti",
        "subject",
        "requester",
        "access",
        "ticket_type",
        "context"
      ],
      "additionalProperties": {}
    },
    {
      "type": "object",
      "properties": {
        "iss": {
          "type": "string",
          "minLength": 1
        },
        "aud": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            }
          ]
        },
        "aud_type": {
          "type": "string",
          "enum": [
            "data_holder_url",
            "trust_framework"
          ]
        },
        "exp": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "iat": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "jti": {
          "type": "string",
          "minLength": 1
        },
        "presenter_binding": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "const": "jkt"
                },
                "jkt": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "method",
                "jkt"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "const": "trust_framework_client"
                },
                "trust_framework": {
                  "type": "string",
                  "minLength": 1
                },
                "framework_type": {
                  "type": "string",
                  "enum": [
                    "well-known",
                    "udap",
                    "oidf"
                  ]
                },
                "entity_uri": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "method",
                "trust_framework",
                "framework_type",
                "entity_uri"
              ],
              "additionalProperties": false
            }
          ]
        },
        "revocation": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "minLength": 1
            },
            "index": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "url",
            "index"
          ],
          "additionalProperties": false
        },
        "must_understand": {
          "minItems": 1,
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]*$"
          }
        },
        "subject": {
          "type": "object",
          "properties": {
            "patient": {
              "type": "object",
              "properties": {
                "resourceType": {
                  "type": "string",
                  "const": "Patient"
                },
                "identifier": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      },
                      "type": {
                        "type": "object",
                        "properties": {
                          "coding": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "display": {
                                  "type": "string"
                                }
                              },
                              "additionalProperties": {}
                            }
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "name": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "family": {
                        "type": "string"
                      },
                      "given": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "prefix": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "suffix": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "birthDate": {
                  "type": "string"
                },
                "gender": {
                  "type": "string"
                }
              },
              "required": [
                "resourceType"
              ],
              "additionalProperties": {}
            },
            "recipient_record": {
              "type": "object",
              "properties": {
                "reference": {
                  "type": "string"
                },
                "identifier": {
                  "type": "object",
                  "properties": {
                    "system": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    },
                    "type": {
                      "type": "object",
                      "properties": {
                        "coding": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "system": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "display": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": {}
                          }
                        },
                        "text": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": {}
                    }
                  },
                  "additionalProperties": {}
                },
                "type": {
                  "type": "string",
                  "const": "Patient"
                },
                "display": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            }
          },
          "required": [
            "patient"
          ],
          "additionalProperties": false
        },
        "requester": {
          "type": "object",
          "properties": {
            "resourceType": {
              "type": "string",
              "const": "Organization"
            },
            "name": {
              "type": "string"
            },
            "identifier": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "system": {
                    "type": "string"
                  },
                  "value": {
                    "type": "string"
                  },
                  "type": {
                    "type": "object",
                    "properties": {
                      "coding": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "additionalProperties": {}
              }
            }
          },
          "required": [
            "resourceType"
          ],
          "additionalProperties": {}
        },
        "access": {
          "type": "object",
          "properties": {
            "permissions": {
              "minItems": 1,
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "data"
                      },
                      "resource_type": {
                        "type": "string",
                        "minLength": 1
                      },
                      "interactions": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "read",
                            "search",
                            "history",
                            "create",
                            "update",
                            "patch",
                            "delete"
                          ]
                        }
                      },
                      "category_any_of": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      },
                      "code_any_of": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      }
                    },
                    "required": [
                      "kind",
                      "resource_type",
                      "interactions"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "operation"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "target": {
                        "type": "object",
                        "properties": {
                          "reference": {
                            "type": "string"
                          },
                          "identifier": {
                            "type": "object",
                            "properties": {
                              "system": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              },
                              "type": {
                                "type": "object",
                                "properties": {
                                  "coding": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "system": {
                                          "type": "string"
                                        },
                                        "code": {
                                          "type": "string"
                                        },
                                        "display": {
                                          "type": "string"
                                        }
                                      },
                                      "additionalProperties": {}
                                    }
                                  },
                                  "text": {
                                    "type": "string"
                                  }
                                },
                                "additionalProperties": {}
                              }
                            },
                            "additionalProperties": {}
                          },
                          "type": {
                            "type": "string"
                          },
                          "display": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "kind",
                      "name"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "data_period": {
              "type": "object",
              "properties": {
                "start": {
                  "type": "string"
                },
                "end": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            },
            "data_holder_filter": {
              "minItems": 1,
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "jurisdiction"
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "country": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "kind",
                      "address"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "organization"
                      },
                      "organization": {
                        "type": "object",
                        "properties": {
                          "resourceType": {
                            "type": "string",
                            "const": "Organization"
                          },
                          "name": {
                            "type": "string"
                          },
                          "identifier": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "object",
                                  "properties": {
                                    "coding": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "system": {
                                            "type": "string"
                                          },
                                          "code": {
                                            "type": "string"
                                          },
                                          "display": {
                                            "type": "string"
                                          }
                                        },
                                        "additionalProperties": {}
                                      }
                                    },
                                    "text": {
                                      "type": "string"
                                    }
                                  },
                                  "additionalProperties": {}
                                }
                              },
                              "additionalProperties": {}
                            }
                          }
                        },
                        "required": [
                          "resourceType"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "kind",
                      "organization"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "sensitive_data": {
              "type": "string",
              "enum": [
                "exclude",
                "include"
              ]
            }
          },
          "required": [
            "permissions"
          ],
          "additionalProperties": false
        },
        "ticket_type": {
          "type": "string",
          "const": "https://smarthealthit.org/permission-ticket-type/research-study-access-v1"
        },
        "context": {
          "type": "object",
          "properties": {
            "study": {
              "type": "object",
              "properties": {
                "resourceType": {
                  "type": "string",
                  "const": "ResearchStudy"
                },
                "identifier": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      },
                      "type": {
                        "type": "object",
                        "properties": {
                          "coding": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "display": {
                                  "type": "string"
                                }
                              },
                              "additionalProperties": {}
                            }
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "status": {
                  "type": "string",
                  "minLength": 1
                },
                "title": {
                  "type": "string"
                }
              },
              "required": [
                "resourceType",
                "status"
              ],
              "additionalProperties": {}
            }
          },
          "required": [
            "study"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "iss",
        "aud",
        "exp",
        "jti",
        "subject",
        "requester",
        "access",
        "ticket_type",
        "context"
      ],
      "additionalProperties": {}
    },
    {
      "type": "object",
      "properties": {
        "iss": {
          "type": "string",
          "minLength": 1
        },
        "aud": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1
            },
            {
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "string",
                "minLength": 1
              }
            }
          ]
        },
        "aud_type": {
          "type": "string",
          "enum": [
            "data_holder_url",
            "trust_framework"
          ]
        },
        "exp": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "iat": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991
        },
        "jti": {
          "type": "string",
          "minLength": 1
        },
        "presenter_binding": {
          "oneOf": [
            {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "const": "jkt"
                },
                "jkt": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "method",
                "jkt"
              ],
              "additionalProperties": false
            },
            {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "const": "trust_framework_client"
                },
                "trust_framework": {
                  "type": "string",
                  "minLength": 1
                },
                "framework_type": {
                  "type": "string",
                  "enum": [
                    "well-known",
                    "udap",
                    "oidf"
                  ]
                },
                "entity_uri": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "method",
                "trust_framework",
                "framework_type",
                "entity_uri"
              ],
              "additionalProperties": false
            }
          ]
        },
        "revocation": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "minLength": 1
            },
            "index": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "url",
            "index"
          ],
          "additionalProperties": false
        },
        "must_understand": {
          "minItems": 1,
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]*$"
          }
        },
        "subject": {
          "type": "object",
          "properties": {
            "patient": {
              "type": "object",
              "properties": {
                "resourceType": {
                  "type": "string",
                  "const": "Patient"
                },
                "identifier": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      },
                      "type": {
                        "type": "object",
                        "properties": {
                          "coding": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "display": {
                                  "type": "string"
                                }
                              },
                              "additionalProperties": {}
                            }
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "name": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "family": {
                        "type": "string"
                      },
                      "given": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "prefix": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "suffix": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "birthDate": {
                  "type": "string"
                },
                "gender": {
                  "type": "string"
                }
              },
              "required": [
                "resourceType"
              ],
              "additionalProperties": {}
            },
            "recipient_record": {
              "type": "object",
              "properties": {
                "reference": {
                  "type": "string"
                },
                "identifier": {
                  "type": "object",
                  "properties": {
                    "system": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    },
                    "type": {
                      "type": "object",
                      "properties": {
                        "coding": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "system": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "display": {
                                "type": "string"
                              }
                            },
                            "additionalProperties": {}
                          }
                        },
                        "text": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": {}
                    }
                  },
                  "additionalProperties": {}
                },
                "type": {
                  "type": "string",
                  "const": "Patient"
                },
                "display": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            }
          },
          "required": [
            "patient"
          ],
          "additionalProperties": false
        },
        "requester": {
          "type": "object",
          "properties": {
            "resourceType": {
              "type": "string",
              "const": "PractitionerRole"
            },
            "code": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "coding": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "system": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "display": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": {}
                    }
                  },
                  "text": {
                    "type": "string"
                  }
                },
                "additionalProperties": {}
              }
            },
            "identifier": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "system": {
                    "type": "string"
                  },
                  "value": {
                    "type": "string"
                  },
                  "type": {
                    "type": "object",
                    "properties": {
                      "coding": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      },
                      "text": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "additionalProperties": {}
              }
            }
          },
          "required": [
            "resourceType"
          ],
          "additionalProperties": {}
        },
        "access": {
          "type": "object",
          "properties": {
            "permissions": {
              "minItems": 1,
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "data"
                      },
                      "resource_type": {
                        "type": "string",
                        "minLength": 1
                      },
                      "interactions": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "read",
                            "search",
                            "history",
                            "create",
                            "update",
                            "patch",
                            "delete"
                          ]
                        }
                      },
                      "category_any_of": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      },
                      "code_any_of": {
                        "minItems": 1,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "system": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "display": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": {}
                        }
                      }
                    },
                    "required": [
                      "kind",
                      "resource_type",
                      "interactions"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "operation"
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "target": {
                        "type": "object",
                        "properties": {
                          "reference": {
                            "type": "string"
                          },
                          "identifier": {
                            "type": "object",
                            "properties": {
                              "system": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              },
                              "type": {
                                "type": "object",
                                "properties": {
                                  "coding": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "system": {
                                          "type": "string"
                                        },
                                        "code": {
                                          "type": "string"
                                        },
                                        "display": {
                                          "type": "string"
                                        }
                                      },
                                      "additionalProperties": {}
                                    }
                                  },
                                  "text": {
                                    "type": "string"
                                  }
                                },
                                "additionalProperties": {}
                              }
                            },
                            "additionalProperties": {}
                          },
                          "type": {
                            "type": "string"
                          },
                          "display": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "kind",
                      "name"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "data_period": {
              "type": "object",
              "properties": {
                "start": {
                  "type": "string"
                },
                "end": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            },
            "data_holder_filter": {
              "minItems": 1,
              "type": "array",
              "items": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "jurisdiction"
                      },
                      "address": {
                        "type": "object",
                        "properties": {
                          "country": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "required": [
                      "kind",
                      "address"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "organization"
                      },
                      "organization": {
                        "type": "object",
                        "properties": {
                          "resourceType": {
                            "type": "string",
                            "const": "Organization"
                          },
                          "name": {
                            "type": "string"
                          },
                          "identifier": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "object",
                                  "properties": {
                                    "coding": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "system": {
                                            "type": "string"
                                          },
                                          "code": {
                                            "type": "string"
                                          },
                                          "display": {
                                            "type": "string"
                                          }
                                        },
                                        "additionalProperties": {}
                                      }
                                    },
                                    "text": {
                                      "type": "string"
                                    }
                                  },
                                  "additionalProperties": {}
                                }
                              },
                              "additionalProperties": {}
                            }
                          }
                        },
                        "required": [
                          "resourceType"
                        ],
                        "additionalProperties": {}
                      }
                    },
                    "required": [
                      "kind",
                      "organization"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            },
            "sensitive_data": {
              "type": "string",
              "enum": [
                "exclude",
                "include"
              ]
            }
          },
          "required": [
            "permissions"
          ],
          "additionalProperties": false
        },
        "ticket_type": {
          "type": "string",
          "const": "https://smarthealthit.org/permission-ticket-type/provider-consult-v1"
        },
        "context": {
          "type": "object",
          "properties": {
            "reason": {
              "type": "object",
              "properties": {
                "coding": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string"
                      },
                      "code": {
                        "type": "string"
                      },
                      "display": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "text": {
                  "type": "string"
                }
              },
              "additionalProperties": {}
            },
            "consult_request": {
              "type": "object",
              "properties": {
                "resourceType": {
                  "type": "string",
                  "const": "ServiceRequest"
                },
                "identifier": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string"
                      },
                      "value": {
                        "type": "string"
                      },
                      "type": {
                        "type": "object",
                        "properties": {
                          "coding": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "system": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "display": {
                                  "type": "string"
                                }
                              },
                              "additionalProperties": {}
                            }
                          },
                          "text": {
                            "type": "string"
                          }
                        },
                        "additionalProperties": {}
                      }
                    },
                    "additionalProperties": {}
                  }
                },
                "status": {
                  "type": "string",
                  "minLength": 1
                },
                "intent": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "required": [
                "resourceType",
                "status",
                "intent"
              ],
              "additionalProperties": {}
            }
          },
          "required": [
            "reason",
            "consult_request"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "iss",
        "aud",
        "exp",
        "jti",
        "subject",
        "requester",
        "access",
        "ticket_type",
        "context"
      ],
      "additionalProperties": {}
    }
  ]
}
