{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "Document": {
      "type": "object",
      "required": [
        "@type"
      ],
      "properties": {
        "@type": {
          "type": "array",
          "contains": {
            "const": "fdic:Document"
          }
        },
        "fdic:institutions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Institution"
          }
        }
      },
      "additionalProperties": false
    },
    "Institution": {
      "type": "object",
      "required": [
        "@type"
      ],
      "properties": {
        "@type": {
          "type": "array",
          "contains": {
            "const": "fdic:Institution"
          }
        },
        "https://spec.edmcouncil.org/fibo/ontology/BE/Corporations/Corporations/RegistrationIdentifier": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "integer",
                "minLength": 1
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#integer"
              }
            }
          }
        },
        "https://schema.org/name": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:branches": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Branch"
          }
        },
        "@index": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "Branch": {
      "type": "object",
      "required": [
        "@type"
      ],
      "properties": {
        "@type": {
          "type": "array",
          "contains": {
            "const": "fdic:Branch"
          }
        },
        "fdic:locationId": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "integer",
                "minLength": 1
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#integer"
              }
            }
          }
        },
        "https://schema.org/name": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:officeNumber": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "integer"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#integer"
              }
            }
          }
        },
        "fdic:mainOffice": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "boolean"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#boolean"
              }
            }
          }
        },
        "fdic:runDate": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "https://schema.org/foundingDate": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "https://spec.edmcouncil.org/fibo/ontology/FND/DatesAndTimes/FinancialDates/hasAcquisitionDate": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:address": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PostalAddress"
          }
        },
        "fdic:location": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/GeoPoint"
          }
        },
        "fdic:geoContext": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/GeoContext"
          }
        },
        "fdic:regulatory": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RegulatoryStatus"
          }
        },
        "@index": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "PostalAddress": {
      "type": "object",
      "required": [],
      "properties": {
        "https://schema.org/streetAddress": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:street2": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "https://schema.org/addressLocality": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "https://schema.org/addressRegion": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:county": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "https://schema.org/postalCode": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        }
      },
      "additionalProperties": false
    },
    "GeoPoint": {
      "type": "object",
      "required": [],
      "properties": {
        "http://www.w3.org/2003/01/geo/wgs84_pos#lat": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "number"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#double"
              }
            }
          }
        },
        "http://www.w3.org/2003/01/geo/wgs84_pos#long": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "number"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#double"
              }
            }
          }
        }
      },
      "additionalProperties": false
    },
    "GeoContext": {
      "type": "object",
      "required": [],
      "properties": {
        "fdic:cbsa": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:cbsaDiv": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:cbsaDivFlag": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "boolean"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#boolean"
              }
            }
          }
        },
        "fdic:cbsaDivNo": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:cbsaMetro": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:cbsaMetroFlag": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "boolean"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#boolean"
              }
            }
          }
        },
        "fdic:cbsaMetroName": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:cbsaMicroFlag": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "boolean"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#boolean"
              }
            }
          }
        },
        "fdic:cbsaNo": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:csa": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:csaFlag": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "boolean"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#boolean"
              }
            }
          }
        },
        "fdic:csaNo": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        }
      },
      "additionalProperties": false
    },
    "RegulatoryStatus": {
      "type": "object",
      "required": [],
      "properties": {
        "https://spec.edmcouncil.org/fibo/ontology/FBC/FunctionalEntities/FinancialServicesEntities/FinancialInstitution": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:mdiStatusCode": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "integer"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#integer"
              }
            }
          }
        },
        "https://banks.data.fdic.gov/ontology/hasMinorityStatus": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:serviceTypeCode": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "integer"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#integer"
              }
            }
          }
        },
        "https://banks.data.fdic.gov/ontology/hasServiceType": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:fdicInstitutionId": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:uninum": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:stateFips": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        },
        "fdic:stateName": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "@value",
              "@type"
            ],
            "properties": {
              "@value": {
                "type": "string"
              },
              "@type": {
                "const": "http://www.w3.org/2001/XMLSchema#string"
              }
            }
          }
        }
      },
      "additionalProperties": false
    }
  },
  "type": "array",
  "items": {
    "type": "object",
    "required": [
      "@type"
    ],
    "properties": {
      "@type": {
        "type": "array",
        "items": {
          "type": "string"
        }
      }
    },
    "allOf": [
      {
        "if": {
          "properties": {
            "@type": {
              "contains": {
                "const": "fdic:Document"
              }
            }
          }
        },
        "then": {
          "$ref": "#/$defs/Document"
        }
      },
      {
        "if": {
          "properties": {
            "@type": {
              "contains": {
                "const": "fdic:Institution"
              }
            }
          }
        },
        "then": {
          "$ref": "#/$defs/Institution"
        }
      },
      {
        "if": {
          "properties": {
            "@type": {
              "contains": {
                "const": "fdic:Branch"
              }
            }
          }
        },
        "then": {
          "$ref": "#/$defs/Branch"
        }
      }
    ]
  }
}
