{
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"$id": "eCH-0108",
	"description": "eCH-0108",
	"type": "object",
	"version": "7.0",
	"properties": {
		"legalUnit": {
			"$ref": "#/$defs/legalUnitType"
		},
		"legalUnitMasterData": {
			"$ref": "#/$defs/legalUnitMasterDataType"
		},
		"localUnitMasterData": {
			"$ref": "#/$defs/localUnitMasterDataType"
		}
	},
	"additionalProperties": false,
	"$defs": {
		"legalUnitType": {
			"type": "object",
			"properties": {
				"legalUnitKeyData": {
					"$ref": "#/$defs/legalUnitKeyDataType"
				},
				"legalUnitAdditionalData": {
					"$ref": "#/$defs/legalUnitAdditionalDataType"
				}
			},
			"required": [
				"legalUnitKeyData"
			],
			"additionalProperties": false
		},
		"legalUnitKeyDataType": {
			"type": "object",
			"properties": {
				"commercialRegisterStatus": {
					"$ref": "#/$defs/registerStatusType"
				},
				"vatRegisterStatus": {
					"$ref": "#/$defs/registerStatusType"
				},
				"vatStartOfObligation": {
					"type": "string",
					"format": "date"
				},
				"vatEndOfObligation": {
					"type": "string",
					"format": "date"
				},
				"vatUid": {
					"$ref": "#/$defs/uidType"
				},
				"lei": {
					"$ref": "#/$defs/leiType"
				},
				"leiRegisterRelationStatus": {
					"$ref": "#/$defs/leiRegisterStatusType"
				},
				"legalUnitMasterData": {
					"$ref": "#/$defs/legalUnitMasterDataType"
				}
			},
			"required": [
				"legalUnitMasterData"
			],
			"additionalProperties": false
		},
		"localUnitMasterDataType": {
			"type": "object",
			"properties": {
				"localId": {
					"$ref": "#/$defs/localIdType"
				},
				"mainUid": {
					"$ref": "#/$defs/uidType"
				},
				"name": {
					"$ref": "#/$defs/unitNameType"
				},
				"additionalName": {
					"$ref": "#/$defs/unitNameType"
				},
				"status": {
					"$ref": "#/$defs/unitStatusType"
				},
				"statusDate": {
					"type": "string",
					"format": "date"
				},
				"sizeClassFte": {
					"$ref": "#/$defs/sizeClassFteType",
					"description": "DataType is defined in the schema and possible values are documented on the platform i14y : https://www.i14y.admin.ch/en/home"
				},
				"email": {
					"$ref": "#/$defs/emailType",
					"description": "DataType is defined in the schema and possible values are documented on the platform i14y : https://www.i14y.admin.ch/en/home"
				},
				"websiste": {
					"$ref": "#/$defs/websiteType",
					"description": "DataType is defined in the schema and possible values are documented on the platform i14y : https://www.i14y.admin.ch/en/home"
				},
				"nogaCode": {
					"$ref": "#/$defs/nogaCodeType",
					"description": "DataType is defined in the schema and possible values are documented on the platform i14y : https://www.i14y.admin.ch/en/home"
				},
				"nogaVersion": {
					"$ref": "#/$defs/nogaVersionType"
				},
				"activityDescription": {
					"$ref": "#/$defs/activityDescriptionType"
				},
				"mainAddress": {
					"$ref": "#/$defs/mainAddressType"
				},
				"additionalLocationAddress": {
					"$ref": "#/$defs/additionalLocationAddressType"
				},
				"additionalPostOfficeBoxAddress": {
					"$ref": "#/$defs/additionalPostOfficeBoxAddressType"
				}
			},
			"required": [
				"name",
				"mainAddress"
			],
			"additionalProperties": false
		},
		"legalUnitMasterDataType": {
			"type": "object",
			"properties": {
				"uid": {
					"$ref": "#/$defs/uidType"
				},
				"mainUid": {
					"$ref": "#/$defs/uidType"
				},
				"name": {
					"$ref": "#/$defs/unitNameType"
				},
				"additionalName": {
					"$ref": "#/$defs/unitNameType"
				},
				"translatedName": {
					"$ref": "#/$defs/unitNameType"
				},
				"status": {
					"$ref": "#/$defs/unitStatusType"
				},
				"statusDate": {
					"type": "string",
					"format": "date"
				},
				"legalForm": {
					"$ref": "#/$defs/legalFormType",
					"description": "DataType is defined in the schema and possible values are documented on the platform i14y : https://www.i14y.admin.ch/en/home"
				},
				"mainAddress": {
					"$ref": "#/$defs/mainAddressType"
				},
				"additionalPostOfficeBoxAddress": {
					"$ref": "#/$defs/additionalPostOfficeBoxAddressType"
				}
			},
			"required": [
				"name",
				"legalForm",
				"mainAddress"
			],
			"additionalProperties": false
		},
		"legalUnitAdditionalDataType": {
			"type": "object",
			"properties": {
				"legalUnitType": {
					"$ref": "#/$defs/legalUnitTypeType"
				},
				"firstRegistrationDate": {
					"type": "string",
					"format": "date"
				},
				"publicStatus": {
					"$ref": "#/$defs/uidPublicStatusType"
				},
				"replacementUid": {
					"$ref": "#/$defs/uidType"
				},
				"nogaCode": {
					"$ref": "#/$defs/nogaCodeType",
					"description": "DataType is defined in the schema and possible values are documented on the platform i14y : https://www.i14y.admin.ch/en/home"
				},
				"nogaVersion": {
					"$ref": "#/$defs/nogaVersionType"
				},
				"activityDescription": {
					"$ref": "#/$defs/activityDescriptionType"
				},
				"cessationReason": {
					"$ref": "#/$defs/cessationReasonType",
					"description": "DataType is defined in the schema and possible values are documented on the platform i14y : https://www.i14y.admin.ch/en/home"
				},
				"commercialRegisterActivationDate": {
					"type": "string",
					"format": "date"
				},
				"commercialRegisterCessationDate": {
					"type": "string",
					"format": "date"
				},
				"otherRegister": {
					"type": "array",
					"items": {
						"$ref": "#/$defs/otherRegisterType"
					}
				},
				"soleProprietorshipPerson": {
					"$ref": "#/$defs/soleProprietorshipPersonType"
				},
				"email": {
					"$ref": "#/$defs/emailType"
				},
				"website": {
					"$ref": "#/$defs/websiteType"
				},
				"correspondenceLanguage": {
					"$ref": "#/$defs/correspondenceLanguageType"
				},
				"additionalLocationAddress": {
					"$ref": "#/$defs/additionalLocationAddressType"
				},
				"foreignOrganisationInformation": {
					"$ref": "#/$defs/foreignOrganisationInformationType"
				}
			},
			"additionalProperties": false
		},
		"soleProprietorshipPersonType": {
			"type": "object",
			"properties": {
				"socialSecurityNumber": {
					"$ref": "#/$defs/vnType"
				},
				"firstName": {
					"$ref": "#/$defs/firstNameType"
				},
				"lastName": {
					"$ref": "#/$defs/lastNameType"
				},
				"birthDate": {
					"$ref": "#/$defs/datePartiallyKnownType"
				},
				"deathDate": {
					"type": "string",
					"format": "date"
				}
			},
			"required": [
				"firstName",
				"lastName"
			],
			"additionalProperties": false
		},
		"cantonAbbreviationType": {
			"type": "string",
			"maxLength": 2,
			"enum": [
				"ZH",
				"BE",
				"LU",
				"UR",
				"SZ",
				"OW",
				"NW",
				"GL",
				"ZG",
				"FR",
				"SO",
				"BS",
				"BL",
				"SH",
				"AR",
				"AI",
				"SG",
				"GR",
				"AG",
				"TG",
				"TI",
				"VD",
				"VS",
				"NE",
				"GE",
				"JU"
			]
		},
		"careOfAddressLineType": {
			"type": "string",
			"minLength": 1,
			"maxLength": 150
		},
		"complementAddressLineType": {
			"type": "string",
			"minLength": 1,
			"maxLength": 200
		},
		"attentionOfAddressLineType": {
			"type": "string",
			"minLength": 1,
			"maxLength": 60
		},
		"municipalityIdType": {
			"type": "integer",
			"minimum": 1,
			"maximum": 9999
		},
		"municipalityNameType": {
			"type": "string",
			"maxLength": 40
		},
		"countryIdISO2Type": {
			"type": "string",
			"maxLength": 2
		},
		"firstNameType": {
			"type": "string",
			"minLength": 1,
			"maxLength": 100
		},
		"lastNameType": {
			"type": "string",
			"minLength": 1,
			"maxLength": 100
		},
		"houseNumberType": {
			"type": "string",
			"maxLength": 30
		},
		"postOfficeBoxNumberType": {
			"type": "integer",
			"minimum": 0,
			"maximum": 99999999
		},
		"streetType": {
			"type": "string",
			"maxLength": 150
		},
		"foreignZipCodeType": {
			"description": "is only expected for foreign addresses",
			"type": "string",
			"maxLength": 15
		},
		"townType": {
			"type": "string",
			"maxLength": 40
		},
		"gYearType": {
			"type": "string",
			"pattern": "^([0-9]{4})$"
		},
		"gYearMonthType": {
			"type": "string",
			"pattern": "^([0-9][1-9]-[0-9]{4})$"
		},
		"datePartiallyKnownType": {
			"type": "object",
			"oneOf": [
				{   
                    "type": "object",
                    "properties": {
                    	"year":{"$ref": "#/$defs/gYearType"}	
                    },
                    "required": ["year"],
                    "additionalProperties": false
				},
                {
                  "type": "object",  
                  "properties": {
                    	"yearMonth":{"$ref": "#/$defs/gYearMonthType"}	
                    },
                    "required": ["yearMonth"],
                    "additionalProperties": false	
				},
                {
                  "type": "object",   
                  "properties": {
                    	"yearMonthDay":{"$ref": "#/$defs/yearMonthDayType"}	
                    },
                    "required": ["yearMonthDay"],
                    "additionalProperties": false	
				}
			]
		},
		"yearMonthDayType": {
			"type": "string",
			"format": "date"
		},
		"vnType": {
			"type": "integer",
			"minimum": 7560000000001,
			"maximum": 7569999999999
		},
		"localIdType": {
			"type": "string",
			"minLength": 9,
			"maxLength": 9,
			"pattern": "^[A-B][1-9][0-9]{7}$"
		},
		"uidType": {
			"type": "string",
			"minLength": 12,
			"maxLength": 12,
			"pattern": "^CHE[1-9][0-9]{8}$"
		},
		"cessationReasonType": {
			"type": "string",
			"minLength": 1,
			"maxLength": 10
		},
		"nogaCodeType": {
			"type": "string",
			"minLength": 6,
			"maxLength": 6,
			"pattern": "^[0-9]{6}$"
		},
		"nogaVersionType": {
			"type": "string",
			"minLength": 1,
			"maxLength": 100
		},
		"NACECodeType": {
			"type": "string",
			"minLength": 4,
			"maxLength": 4,
			"pattern": "^[0-9]{4}$"
		},
		"ISICCodeType": {
			"type": "string",
			"minLength": 2,
			"maxLength": 2,
			"pattern": "^[0-9]{2}$"
		},
		"activityDescriptionType": {
			"type": "string",
			"minLength": 1,
			"maxLength": 10000
		},
		"sizeClassFteType": {
			"type": "integer",
			"minimum": 1,
			"maximum": 12
		},
		"addressCategoryType": {
			"type": "string",
			"enum": [
				"correspondenceAddress",
				"liquidationAddress"
			]
		},
		"mainAddressType": {
			"type": "object",
			"properties": {
				"careOfAddressLine": {
					"$ref": "#/$defs/careOfAddressLineType"
				},
				"complementAddressLine": {
					"$ref": "#/$defs/complementAddressLineType"
				},
				"locationAddressDetails": {
					"$ref": "#/$defs/locationAddressDetailsType"
				},
				"postDeliverabilityCheckDate": {
					"type": "string",
					"format": "date"
				},
				"postDeliverabilityStatus": {
					"$ref": "#/$defs/postDeliverabilityStatusType"
				}
			},
			"required": [
				"locationAddressDetails"
			],
			"additionalProperties": false
		},
		"additionalLocationAddressType": {
			"type": "object",
			"properties": {
				"addressCategory": {
					"$ref": "#/$defs/addressCategoryType"
				},
				"careOfAddressLine": {
					"$ref": "#/$defs/careOfAddressLineType"
				},
				"attentionOfAddressLine": {
					"$ref": "#/$defs/attentionOfAddressLineType"
				},
				"complementAddressLine": {
					"$ref": "#/$defs/complementAddressLineType"
				},
				"postDeliverabilityStatus": {
					"$ref": "#/$defs/postDeliverabilityStatusType"
				},
				"postDeliverabilityCheckDate": {
					"type": "string",
					"format": "date"
				},
				"locationAddressDetails": {
					"$ref": "#/$defs/locationAddressDetailsType"
				}
			},
			"required": [
				"addressCategory",
				"locationAddressDetails"
			],
			"additionalProperties": false
		},
		"additionalPostOfficeBoxAddressType": {
			"type": "object",
			"properties": {
				"addressCategory": {
					"$ref": "#/$defs/addressCategoryType"
				},
				"attentionOfAddressLine": {
					"$ref": "#/$defs/attentionOfAddressLineType"
				},
				"cantonAbbreviation": {
					"$ref": "#/$defs/cantonAbbreviationType"
				},
				"careOfAddressLine": {
					"$ref": "#/$defs/careOfAddressLineType"
				},
				"complementAddressLine": {
					"$ref": "#/$defs/complementAddressLineType"
				},
				"country": {
					"$ref": "#/$defs/countryIdISO2Type"
				},
				"postDeliverabilityCheckDate": {
					"type": "string",
					"format": "date"
				},
				"postDeliverabilityStatus": {
					"$ref": "#/$defs/postDeliverabilityStatusType"
				},
				"postOfficeBoxNumber": {
					"$ref": "#/$defs/postOfficeBoxNumberType"
				},
				"town": {
					"$ref": "#/$defs/townType"
				},
				"zipCode": {
					"$ref": "#/$defs/zipCodeType",
					"description": "is only expected for swiss addresses. Must be null for foreign addresses"
				}
			},
			"required": [
				"addressCategory",
				"country",
				"town"
			],
			"additionalProperties": false
		},
		"foreignLocationAddressType": {
			"type": "object",
			"properties": {
				"careOfAddressLine": {
					"$ref": "#/$defs/careOfAddressLineType"
				},
				"complementAddressLine": {
					"$ref": "#/$defs/complementAddressLineType"
				},
				"foreignLocationAddressDetails": {
					"$ref": "#/$defs/foreignLocationAddressDetailsType"
				}
			},
			"required": [
				"foreignLocationAddressDetails"
			],
			"additionalProperties": false
		},
		"locationAddressDetailsType": {
			"type": "object",
			"properties": {
				"street": {
					"$ref": "#/$defs/streetType"
				},
				"houseNumber": {
					"$ref": "#/$defs/houseNumberType"
				},
				"language": {
					"$ref": "#/$defs/addressLanguageType"
				},
				"cantonAbbreviation": {
					"$ref": "#/$defs/cantonAbbreviationType"
				},
				"municipality": {
					"$ref": "#/$defs/municipalityNameType"
				},
				"town": {
					"$ref": "#/$defs/townType"
				},
				"zipCode": {
					"$ref": "#/$defs/zipCodeType"
				},
				"country": {
					"$ref": "#/$defs/countryIdISO2Type"
				},
				"EGAID": {
					"$ref": "#/$defs/EGAIDType"
				},
				"GDEID": {
					"$ref": "#/$defs/municipalityIdType"
				},
				"EGID": {
					"$ref": "#/$defs/EGIDType"
				},
				"EDID": {
					"$ref": "#/$defs/EDIDType"
				},
				"ESID": {
					"$ref": "#/$defs/ESIDType"
				},
				"coordinatesNorth": {
					"$ref": "#/$defs/coordinatesNorthType"
				},
				"coordinatesEast": {
					"$ref": "#/$defs/coordinatesEastType"
				}
			},
			"required": [
				"town",
				"country"
			],
			"additionalProperties": false
		},
		"foreignLocationAddressDetailsType": {
			"type": "object",
			"properties": {
				"street": {
					"$ref": "#/$defs/streetType"
				},
				"houseNumber": {
					"$ref": "#/$defs/houseNumberType"
				},
				"foreignZipCode": {
					"$ref": "#/$defs/foreignZipCodeType"
				},
				"town": {
					"$ref": "#/$defs/townType"
				},
				"country": {
					"$ref": "#/$defs/countryIdISO2Type"
				}
			},
			"required": [
				"town",
				"country"
			],
			"additionalProperties": false
		},
		"zipCodeType": {
			"type":"object",
			"oneOf":
			[
				{
				"type": "object",
				"properties": {
					"swissZipCode": {
						"description": "is only expected for swiss addresses",
						"type": "integer",
						"minimum": 1000,
						"maximum": 9999
						},
					"swissZipCodeAddOn": {
						"description": "is only expected for swiss addresses",
						"type": "string",
						"maxLength": 2
					}
				},
				"required": [
					"swissZipCode"
				],
				"additionalProperties": false
				},
				{
				"type": "object",
				"properties": {
					"foreignZipCode": {
						"description": "is only expected for foreign addresses",
						"type": "string",
						"maxLength": 15
					}
							
					},
				"additionalProperties": false	
					
				}
			]
		},
		"EGAIDType": {
			"type": "integer",
			"minimum": 100000000,
			"maximum": 900000000
		},
		"EGIDType": {
			"type": "integer",
			"minimum": 1,
			"maximum": 999999999
		},
		"EDIDType": {
			"type": "integer",
			"minimum": 0,
			"maximum": 90
		},
		"ESIDType": {
			"type": "integer",
			"minimum": 10000000,
			"maximum": 90000000
		},
		"coordinatesEastType": {
			"type": "number",
			"minimum": 2480000.000,
			"maximum": 2840000.999,
			"multipleOf": 0.001
		},
		"coordinatesNorthType": {
			"type": "number",
			"minimum": 1070000.000,
			"maximum": 1300000.999,
			"multipleOf": 0.001
		},
		"addressLanguageType": {
			"type": "string",
			"enum": [
				"de",
				"rm",
				"fr",
				"it"
			]
		},
		"postDeliverabilityStatusType": {
			"type": "string",
			"enum": [
				"unchecked",
				"isDeliverable",
				"isNotDeliverable"
			]
		},
		"correspondenceLanguageType": {
			"type": "string",
			"enum": [
				"de",
				"rm",
				"fr",
				"it",
				"en"
			]
		},
		"emailType": {
			"type": "string",
			"maxLength": 100,
			"pattern": "^([\\!#-'\\*-\\+\\-/-9\\=\\?A-Z\\^-~ÄÖÜà-öø-ÿ]+(\\.[\\!#-'\\*-\\+\\-/-9\\=\\?A-Z\\^-~ÄÖÜà-öø-ÿ]+)*@[\\!#-'\\*-\\+\\-/-9\\=\\?A-Z\\^-~ÄÖÜà-öø-ÿ]+(\\.[\\!#-'\\*-\\+\\-/-9\\=\\?A-Z\\^-~ÄÖÜà-öø-ÿ]+)*)$"
		},
		"websiteType": {
			"type": "string",
			"maxLength": 100,
			"pattern": "^(https?\\://[\\--\\.0-9A-Za-z]+\\.[A-Za-z]{2,4}(/[\\w\\D]*)?)$"
		},
		"legalUnitTypeType": {
			"type": "string",
			"enum": [
				"mainLegalUnit",
				"branchLegalUnit"
			]
		},
		"unitNameType": {
			"type": "string",
			"minLength": 1,
			"maxLength": 255
		},
		"legalFormType": {
			"type": "string",
			"minLength": 4,
			"maxLength": 4,
			"pattern": "^[0-9]{4}$"
		},
		"uidPublicStatusType": {
			"type": "string",
			"enum": [
				"public",
				"nonPublic"
			]
		},
		"unitStatusType": {
			"type": "string",
			"enum": [
				"active",
				"cessation"
			]
		},
		"otherRegisterType": {
			"type": "object",
			"properties": {
				"registerEntryIdPrefix": {
					"type": "string",
					"minLength": 1,
					"maxLength": 30
				},
				"registerId": {
					"type": "string",
					"minLength": 12,
					"maxLength": 12,
					"pattern": "^REG[1-9][0-9]{8}$"
				},
				"registerName": {
					"type": "string",
					"minLength": 1,
					"maxLength": 255
				},
				"registerEntryId": {
					"type": "string",
					"minLength": 1,
					"maxLength": 36
				},
				"registerEntryStatus": {
					"$ref": "#/$defs/registerStatusType"
				},
				"registrationDate": {
					"type": "string",
					"format": "date"
				},
				"isResponsibleRegister": {
					"$type": "boolean"
				}
			},
			"required": [
				"registerId"
			],
			"additionalProperties": false
		},
		"registerStatusType": {
			"type": "string",
			"enum": [
				"active",
				"inactive",
				"noRelation"
			]
		},
		"leiType": {
			"type": "string",
			"minLength": 20,
			"maxLength": 20
		},
		"leiRegisterStatusType": {
			"type": "string",
			"enum": [
				"ISSUED",
				"DUPLICATE",
				"LAPSED",
				"MERGED",
				"RETIRED",
				"ANNULED",
				"CANCELLED"
			]
		},
		"foreignOrganisationInformationType": {
			"type": "object",
			"properties": {
				"foreignRegister": {
					"type": "array",
					"items": {
						"$ref": "#/$defs/foreignRegisterType"
					}
				},
				"name": {
					"$ref": "#/$defs/unitNameType"
				},
				"otherName": {
					"type": "array",
					"items": {
						"$ref": "#/$defs/unitNameType"
					}
				},
				"foreignAddress": {
					"$ref": "#/$defs/foreignLocationAddressType"
				},
				"NACECode": {
					"$ref": "#/$defs/NACECodeType",
					"description": "DataType is defined in the schema and possible values are documented on the platform i14y : https://www.i14y.admin.ch/en/home"
				},
				"ISICCode": {
					"$ref": "#/$defs/ISICCodeType",
					"description": "DataType is defined in the schema and possible values are documented on the platform i14y : https://www.i14y.admin.ch/en/home"
				},
				"foreignLegalFormName": {
					"$ref": "#/$defs/foreignLegalFormNameType",
					"description": "\"Entity Legal Form name Transliterated name\" of the following CodeList is expected : https://www.gleif.org/en/about-lei/code-lists/iso-20275-entity-legal-forms-code-list"
				},
				"foreignLegalFormCode": {
					"$ref": "#/$defs/foreignLegalFormCodeType",
					"description": "\"ELF Code\" of the following CodeList is expected : https://www.gleif.org/en/about-lei/code-lists/iso-20275-entity-legal-forms-code-list"
				},
				"qualification": {
					"$ref": "#/$defs/qualificationType"
				}
			},
			"required": [
				"name",
				"foreignAddress"
			],
			"additionalProperties": false
		},
		"foreignRegisterType": {
			"type": "object",
			"properties": {
				"foreignRegisterId": {
					"type": "string",
					"minLength": 1,
					"maxLength": 255
				},
				"foreignRegisterName": {
					"type": "string",
					"minLength": 1,
					"maxLength": 255
				},
				"foreignRegisterEntryId": {
					"type": "string",
					"minLength": 1,
					"maxLength": 36
				},
				"foreignRegisterEntryStatus": {
					"$ref": "#/$defs/registerStatusType"
				},
				"registrationDate": {
					"type": "string",
					"format": "date"
				}
			},
			"required": [
				"foreignRegisterName"
			],
			"additionalProperties": false
		},
		"foreignLegalFormNameType": {
			"type": "string",
			"minLength": 1,
			"maxLength": 255
		},
		"foreignLegalFormCodeType": {
			"type": "string",
			"minLength": 4,
			"maxLength": 4,
			"pattern": "^[A-Z0-9]{4}$"
		},
		"qualificationType": {
			"type": "string",
			"enum": [
				"ENTITY_SUPPLIED_ONLY",
				"PARTIALLY_CORROBORATED",
				"FULLY_CORROBORATED"
			]
		}
	}
}