{
	"definitions": {
		"YYYYMMDDType": {
			"type": "number",
			"minimum": 10000000,
			"maximum": 99999999
		},
		"year": {
			"type": "number",
			"minLength": 4,
			"maxLength": 4,
			"maximum": 9999
		},
		"unsigned": {
			"type": "number",
			"multipleOf": 1,
			"minimum": 0,
			"maximum": 9223372036854775807
		},
		"alphanumeric": {
			"type": "string",
			"pattern": "^[a-zA-Z0-9]*$"
		},
		"alphanumeric-upto-4": {
			"type": "string",
			"pattern": "^[a-zA-Z0-9]*$",
			"maxLength": 4
		},
		"alphanumeric-upto-5": {
			"type": "string",
			"pattern": "^[a-zA-Z0-9]*$",
			"maxLength": 5
		},
		"text": {
   		 "type": "string",
    	"pattern": "^((?![|\"@,])[\\x20-\\x7E])+$"
		},
		"largeTraderIdType": {
			"type": "string",
			"maxLength": 13,
			"examples": [
				"ULT00001-0001",
				"12345678-9012"
			],
			"pattern": "[0-9]{8}-[0-9]{4}|ULT[0-9A-Z]{5}-[0-9A-Z]{4}"
		},
		"firmDesignatedIdType": {
			"type": "string",
			"maxLength": 40,
			"examples": [
				"EZAccount123"
			],
			"pattern": "^((?![|\"@,])[\\x20-\\x7E]){1,40}$"
		},
		"addressList": {
			"type": "array",
			"items": {
				"type": "object",
				"additionalProperties": false,
				"properties": {
					"addrType": {
						"type": "string",
						"enum": [
							"ADDRESS1",
							"ADDRESS2",
							"ADDRESS3",
							"ADDRESS4"
						]
					},
					"addrLine1": {
						"$ref": "#/definitions/extendedText",
						"maxLength": 40
					},
					"addrLine2": {
						"$ref": "#/definitions/extendedText",
						"maxLength": 40
					},
					"addrLine3": {
						"$ref": "#/definitions/extendedText",
						"maxLength": 40
					},
					"addrLine4": {
						"$ref": "#/definitions/extendedText",
						"maxLength": 40
					},
					"city": {
						"$ref": "#/definitions/extendedText",
						"maxLength": 100
					},
					"regionCode": {
						"$ref": "#/definitions/extendedText",
						"maxLength": 40,
						"example": "AA-XX* *Format when countryCode is 'US' or 'CA'"
					},
					"countryCode": {
						"type": "string",
						"example": "US"
					},
					"postalCode": {
						"$ref": "#/definitions/text",
						"maxLength": 15
					}
				}
			}
		},
		"extendedText": {
    			"type": "string",
    			"pattern": "^[\\x20-\\x7E\\xA0-\\xFF]+$"
				}
	},
	"$schema": "http://json-schema.org/draft-07/schema#",
	"type": "object",
	"required": [
		"version",
		"catReporterCRD",
		"catSubmitterID",
		"fdidRecordCount",
		"naturalPersonCustomerRecordCount",
		"legalEntityCustomerRecordCount"
	],
	"additionalProperties": false,
	"properties": {
		"version": {
			"type": "string",
			"maxLength": 10,
			"enum": [
				"2.0.0"
			]
		},
		"catReporterCRD": {
			"$ref": "#/definitions/unsigned"
		},
		"catSubmitterID": {
			"$ref": "#/definitions/unsigned"
		},
		"correspondentCRD": {
			"$ref": "#/definitions/unsigned"
		},
		"fdidRecordCount": {
			"$ref": "#/definitions/unsigned"
		},
		"naturalPersonCustomerRecordCount": {
			"$ref": "#/definitions/unsigned"
		},
		"legalEntityCustomerRecordCount": {
			"$ref": "#/definitions/unsigned"
		},
		"fdidRecordList": {
			"type": "array",
			"items": {
				"type": "object",
				"required": [
					"fdidRecordID",
					"firmDesignatedID",
					"fdidType",
					"fdidDate",
					"accountType"
				],
				"dependencies": {
					"fdidEndDate": [
						"fdidEndReason"
					],
					"fdidEndReason": [
						"fdidEndDate"
					],
					"priorCATReporterCRD": [
						"priorCATReporterFDID"
					]
				},
				"additionalProperties": false,
				"properties": {
					"fdidRecordID": {
						"$ref": "#/definitions/unsigned"
					},
					"firmDesignatedID": {
						"$ref": "#/definitions/firmDesignatedIdType"
					},
					"fdidType": {
						"type": "string",
						"enum": [
							"ACCOUNT",
							"RELATIONSHIP",
							"ENTITYID"
						],
						"examples": [
							"ACCOUNT"
						]
					},
					"fdidDate": {
						"$ref": "#/definitions/YYYYMMDDType"
					},
					"fdidEndDate": {
						"$ref": "#/definitions/YYYYMMDDType"
					},
					"fdidEndReason": {
						"type": "string",
						"enum": [
							"CORRECTION",
							"ENDED",
                            "INACTIVE",
							"REPLACED",
							"OTHER",
							"TRANSFER"
						]
					},
					"replacedByFDID": {
						"$ref": "#/definitions/firmDesignatedIdType"
					},
					"accountType": {
						"type": "array",
						"items": {
							"type": "string",
							"enum": [
								"AVERAGE",
								"DVP/RVP",
								"EDUCATION",
								"ENTITYID",
								"ERROR",
								"FIRM",
								"INSTITUTION",
								"MARKET",
								"MARGIN",
								"OPTION",
								"OTHER",
								"RELATIONSHIP",
								"RETIREMENT",
								"UGMA/UTMA"
							]
						}
					},
					"accountName": {
						"$ref": "#/definitions/extendedText",
						"maxLength": 200
					},
					"DVPCustodianID": {
						"type": "array",
						"items": {
							"$ref": "#/definitions/alphanumeric-upto-5"
						}
					},
					"clearingBrokerID": {
						"type": "array",
						"items": {
							"$ref": "#/definitions/alphanumeric-upto-4"
						}
					},
					"branchOfficeCRD": {
						"$ref": "#/definitions/unsigned"
					},
					"registeredRepCRD": {
						"type": "array",
						"items": {
							"$ref": "#/definitions/unsigned"
						}
					},
					"priorCATReporterCRD": {
						"$ref": "#/definitions/unsigned"
					},
					"priorCATReporterFDID": {
						"$ref": "#/definitions/firmDesignatedIdType"
					},
					"addressList": {
						"$ref": "#/definitions/addressList"
					},
					"fdidCustomerList": {
						"type": "array",
						"items": {
							"type": "object",
							"required": [
								"customerRecordID",
								"role",
								"roleStartDate"
							],
							"dependencies": {
								"roleEndDate": [
									"roleEndReason"
								],
								"roleEndReason": [
									"roleEndDate"
								]
							},
							"additionalProperties": false,
							"properties": {
								"customerRecordID": {
									"$ref": "#/definitions/unsigned"
								},
								"role": {
									"type": "string",
									"enum": [
										"AUTH3RD",
										"AUTHREP",
										"NTHOLDER",
										"TRDHOLDER"
									]
								},
								"hasDiscretion": {
									"type": "boolean"
								},
								"roleStartDate": {
									"$ref": "#/definitions/YYYYMMDDType"
								},
								"roleEndDate": {
									"$ref": "#/definitions/YYYYMMDDType"
								},
								"roleEndReason": {
									"type": "string",
									"enum": [
										"CORRECTION",
										"ENDED",
                                        "INACTIVE",
										"REPLACED",
										"OTHER",
										"TRANSFER"
									]
								}
							}
						}
					},
					"authTraderNamesList": { 
						"type": "array",
						"items": {
							"type": "object",
							"additionalProperties": false,
							"properties": {
								"authTraderNameID": {
									"$ref": "#/definitions/unsigned"
								},
								"authTraderName": {
									"$ref": "#/definitions/extendedText",
									"maxLength": 200
								}
							}
						}
					},
					"largeTraderList": {
						"type": "array",
						"items": {
							"type": "object",
							"required": [
								"largeTraderRecordID",
								"largeTraderID",
								"ltidEffectiveDate"
							],
							"dependencies": {
								"ltidEndDate": [
									"ltidEndReason"
								],
								"ltidEndReason": [
									"ltidEndDate"
								]
							},
							"additionalProperties": false,
							"properties": {
								"largeTraderRecordID": {
									"$ref": "#/definitions/unsigned"
								},
								"largeTraderID": {
									"$ref": "#/definitions/largeTraderIdType"
								},
								"ltidEffectiveDate": {
									"$ref": "#/definitions/YYYYMMDDType"
								},
								"ltidEndDate": {
									"$ref": "#/definitions/YYYYMMDDType"
								},
								"ltidEndReason": {
									"type": "string",
									"enum": [
										"CORRECTION",
										"ENDED",
                                        "INACTIVE",
										"REPLACED",
										"OTHER",
										"TRANSFER"
									]
								}
							}
						}
					}
				}
			}
		},
		"correctionList": {
			"type": "array",
			"items": {
				"type": "object",
				"required": [
					"rejectionID",
					"correctionAction"
				],
				"additionalProperties": false,
				"properties": {
					"rejectionID": {
						"$ref": "#/definitions/unsigned"
					},
					"correctionAction": {
						"type": "string",
						"enum": [
							"CORRECTION",
							"DELETE"
						],
						"examples": [
							"CORRECTION"
						]
					},
					"correctingFirmDesignatedID": {
						"$ref": "#/definitions/firmDesignatedIdType"
					},
					"correctingCustomerRecordID": {
						"$ref": "#/definitions/unsigned"
					}
				}
			}
		},
		"naturalPersonCustomerList": {
			"type": "array",
			"items": {
				"type": "object",
				"required": [
					"customerRecordID",
					"customerType"
				],
				"additionalProperties": false,
				"properties": {
					"customerRecordID": {
						"$ref": "#/definitions/unsigned"
					},
					"customerType": {
						"type": "array",
						"items": {
							"type": "string",
							"enum": [
								"ACCREDITED",
								"ADVISER",
								"CP",
								"EMPLOYEE",
								"FOREIGN",
								"NOTAPPLICABLE",
								"OTHBKR",
								"TRUST"
							]
						}
					},
					"firstName": {
						"$ref": "#/definitions/extendedText",
						"maxLength": 200
					},
					"middleName": {
						"$ref": "#/definitions/extendedText",
						"maxLength": 200
					},
					"lastName": {
						"$ref": "#/definitions/extendedText",
						"maxLength": 200
					},
					"nameSuffix": {
						"type": "string",
						"enum": [
							"FIFTH",
							"FOURTH",
							"JUNIOR",
							"SENIOR",
							"THIRD"
						]
					},
					"yearOfBirth": {
						"$ref": "#/definitions/year"
					},
					"addressList": {
						"$ref": "#/definitions/addressList"
					},
					"updateNotification": {
						"type": "boolean"
					},
					"doingBusinessAs": {
						"$ref": "#/definitions/extendedText",
						"maxLength": 200
					}
				}
			}
		},
		"legalEntityCustomerList": {
			"type": "array",
			"items": {
				"type": "object",
				"required": [
					"customerRecordID",
					"customerType"
				],
				"additionalProperties": false,
				"properties": {
					"customerRecordID": {
						"$ref": "#/definitions/unsigned"
					},
					"customerType": {
						"type": "array",
						"items": {
							"type": "string",
							"enum": [
								"ACCREDITED",
								"ADVISER",
								"BD",
								"FOREIGN",
								"NOTAPPLICABLE",
								"RIC",
								"TRUST"
							]
						}
					},
					"legalName": {
						"$ref": "#/definitions/extendedText",
						"maxLength": 200
					},
					"addressList": {
						"$ref": "#/definitions/addressList"
					},
					"ein": {
						"$ref": "#/definitions/text",
						"maxLength": 10
					},
					"lei": {
						"$ref": "#/definitions/alphanumeric",
						"maxLength": 20
					},
					"updateNotification": {
						"type": "boolean"
					}
				}
			}
		}
	}
}