{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/ivms101-by-code-protocol/latest.json",
  "title": "IVMS101 format by CODE travel rule protocol",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/codevasp-lab/IVMS101/main/json-schema.json",
    "sourceSha256": "2c34622856ca4a2ba61dcc5ea40706655863967ff4a61f3efbb5d0e541f12b2c"
  },
  "type": "object",
  "properties": {
    "Originator": {
      "$ref": "#/$defs/Originator"
    },
    "Beneficiary": {
      "$ref": "#/$defs/Beneficiary"
    },
    "OriginatingVASP": {
      "$ref": "#/$defs/OriginatingVASP"
    },
    "BeneficiaryVASP": {
      "$ref": "#/$defs/BeneficiaryVASP"
    }
  },
  "required": [
    "Originator",
    "Beneficiary",
    "OriginatingVASP",
    "BeneficiaryVASP"
  ],
  "$defs": {
    "LocalNaturalPersonNameId": {
      "title": "LocalNaturalPersonNameId",
      "type": "object",
      "properties": {
        "primaryIdentifier": {
          "type": "string",
          "pattern": "^.{1,100}$"
        },
        "secondaryIdentifier": {
          "type": "string",
          "pattern": "^.{0,100}$"
        },
        "nameIdentifierType": {
          "title": "NaturalPersonNameTypeCode",
          "type": "string",
          "enum": [
            "ALIA",
            "BIRT",
            "MAID",
            "LEGL",
            "MISC"
          ]
        }
      }
    },
    "LocalLegalPersonNameId": {
      "title": "LocalLegalPersonNameId",
      "type": "object",
      "properties": {
        "legalPersonName": {
          "type": "string",
          "pattern": "^.{1,100}$"
        },
        "legalPersonNameIdentifierType": {
          "title": "LegalPersonNameTypeCode",
          "type": "string",
          "enum": [
            "LEGL",
            "SHRT",
            "TRAD"
          ]
        }
      }
    },
    "Address": {
      "title": "Address",
      "type": "object",
      "properties": {
        "addressType": {
          "title": "AddressTypeCode",
          "type": "string",
          "enum": [
            "HOME",
            "BIZZ",
            "GEOG"
          ]
        },
        "department": {
          "type": "string",
          "pattern": "^.{1,50}$"
        },
        "subDepartment": {
          "type": "string",
          "pattern": "^.{1,70}$"
        },
        "streetName": {
          "type": "string",
          "pattern": "^.{1,70}$"
        },
        "buildingNumber": {
          "type": "string"
        },
        "buildingName": {
          "type": "string",
          "pattern": "^.{1,16}$"
        },
        "floor": {
          "type": "string",
          "pattern": "^.{1,70}$"
        },
        "postBox": {
          "type": "string",
          "pattern": "^.{1,16}$"
        },
        "room": {
          "type": "string"
        },
        "postCode": {
          "type": "string",
          "pattern": "^.{1,16}$"
        },
        "townName": {
          "type": "string",
          "pattern": "^.{1,35}$"
        },
        "townLocationName": {
          "type": "string",
          "pattern": "^.{1,35}$"
        },
        "districtName": {
          "type": "string",
          "pattern": "^.{1,35}$"
        },
        "countrySubDivision": {
          "type": "string",
          "pattern": "^.{1,35}$"
        },
        "addressLine": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^.{1,70}$"
          }
        },
        "country": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
        }
      }
    },
    "NationalIdentification": {
      "title": "NationalIdentification",
      "type": "object",
      "properties": {
        "nationalIdentifier": {
          "type": "string",
          "pattern": "^.{1,35}$"
        },
        "nationalIdentifierType": {
          "title": "NationalIdentifierTypeCode",
          "type": "string",
          "enum": [
            "ARNU",
            "CCPT",
            "RAID",
            "DRLC",
            "FIIN",
            "TXID",
            "SOCS",
            "IDCD",
            "LEIX",
            "MISC"
          ]
        },
        "countryOfIssue": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
        },
        "registrationAuthority": {
          "type": "string",
          "pattern": "^RA([0-9]{6})$"
        }
      }
    },
    "Person": {
      "title": "Person",
      "type": "object",
      "properties": {
        "naturalPerson": {
          "$ref": "#/$defs/NaturalPerson"
        },
        "legalPerson": {
          "$ref": "#/$defs/LegalPerson"
        }
      }
    },
    "NaturalPerson": {
      "title": "NaturalPerson",
      "type": "object",
      "properties": {
        "name": {
          "$ref": "#/$defs/NaturalPersonName"
        },
        "geographicAddress": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Address"
          }
        },
        "nationalIdentification": {
          "$ref": "#/$defs/NationalIdentification"
        },
        "customerIdentification": {
          "type": "string",
          "pattern": "^.{1,50}$"
        },
        "dateAndPlaceOfBirth": {
          "$ref": "#/$defs/DateAndPlaceOfBirth"
        },
        "countryOfResidence": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
        }
      }
    },
    "NaturalPersonName": {
      "title": "NaturalPersonName",
      "type": "object",
      "properties": {
        "nameIdentifier": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/NaturalPersonNameId"
          }
        },
        "localNameIdentifier": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LocalNaturalPersonNameId"
          }
        },
        "phoneticNameIdentifier": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LocalNaturalPersonNameId"
          }
        }
      }
    },
    "NaturalPersonNameId": {
      "title": "NaturalPersonNameId",
      "type": "object",
      "properties": {
        "primaryIdentifier": {
          "type": "string"
        },
        "secondaryIdentifier": {
          "type": "string"
        },
        "nameIdentifierType": {
          "title": "NaturalPersonNameTypeCode",
          "type": "string",
          "enum": [
            "ALIA",
            "BIRT",
            "MAID",
            "LEGL",
            "MISC"
          ]
        }
      }
    },
    "DateAndPlaceOfBirth": {
      "title": "DateAndPlaceOfBirth",
      "type": "object",
      "properties": {
        "dateOfBirth": {
          "type": "string",
          "pattern": "^([0-9]{4})-([0-9]{2})-([0-9]{2})$"
        },
        "placeOfBirth": {
          "type": "string",
          "pattern": "^.{1,70}$"
        }
      }
    },
    "LegalPerson": {
      "title": "LegalPerson",
      "type": "object",
      "properties": {
        "name": {
          "$ref": "#/$defs/LegalPersonName"
        },
        "geographicAddress": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Address"
          }
        },
        "customerNumber": {
          "type": "string",
          "pattern": "^.{1,50}$"
        },
        "nationalIdentification": {
          "$ref": "#/$defs/NationalIdentification"
        },
        "countryOfRegistration": {
          "type": "string",
          "pattern": "^[A-Z]{2}$"
        }
      },
      "required": [
        "name"
      ]
    },
    "LegalPersonName": {
      "title": "LegalPersonName",
      "type": "object",
      "properties": {
        "nameIdentifier": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LegalPersonNameId"
          }
        },
        "localNameIdentifier": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LocalLegalPersonNameId"
          }
        },
        "phoneticNameIdentifier": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LocalLegalPersonNameId"
          }
        }
      },
      "required": [
        "nameIdentifier"
      ]
    },
    "LegalPersonNameId": {
      "title": "LegalPersonNameId",
      "type": "object",
      "properties": {
        "legalPersonName": {
          "type": "string",
          "pattern": "^.{1,100}$"
        },
        "legalPersonNameIdentifierType": {
          "title": "LegalPersonNameTypeCode",
          "type": "string",
          "enum": [
            "LEGL",
            "SHRT",
            "TRAD"
          ]
        }
      }
    },
    "Originator": {
      "title": "Originator",
      "type": "object",
      "properties": {
        "originatorPersons": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Person"
          }
        },
        "accountNumber": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "originatorPersons",
        "accountNumber"
      ]
    },
    "Beneficiary": {
      "title": "Beneficiary",
      "type": "object",
      "properties": {
        "beneficiaryPersons": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Person"
          }
        },
        "accountNumber": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "beneficiaryPersons",
        "accountNumber"
      ]
    },
    "OriginatingVASP": {
      "title": "OriginatingVASP",
      "type": "object",
      "properties": {
        "originatingVASP": {
          "$ref": "#/$defs/Person"
        }
      }
    },
    "BeneficiaryVASP": {
      "title": "BeneficiaryVASP",
      "type": "object",
      "properties": {
        "beneficiaryVASP": {
          "$ref": "#/$defs/Person"
        }
      }
    },
    "NaturalPersonNameTypeCode": {
      "title": "NaturalPersonNameTypeCode",
      "type": "string",
      "enum": [
        "ALIA",
        "BIRT",
        "MAID",
        "LEGL",
        "MISC"
      ]
    },
    "LegalPersonNameTypeCode": {
      "title": "LegalPersonNameTypeCode",
      "type": "string",
      "enum": [
        "LEGL",
        "SHRT",
        "TRAD"
      ]
    },
    "AddressTypeCode": {
      "title": "AddressTypeCode",
      "type": "string",
      "enum": [
        "HOME",
        "BIZZ",
        "GEOG"
      ]
    },
    "NationalIdentifierTypeCode": {
      "title": "NationalIdentifierTypeCode",
      "type": "string",
      "enum": [
        "ARNU",
        "CCPT",
        "RAID",
        "DRLC",
        "FIIN",
        "TXID",
        "SOCS",
        "IDCD",
        "LEIX",
        "MISC"
      ]
    }
  }
}
