{
    "$schema": "http://json-schema.org/draft-07/schema",
    "$id": "https://www.yacpdb.org/schemas/yacpdb-person.schema.json",
    "type": "object",
    "properties": {
        "familyname": {
            "$ref": "#/definitions/name_type"
        },
        "givennames": {
            "$ref": "#/definitions/name_type"
        },
        "foreignids": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/foreignid_type"
            },
            "minItems": 1
        },
        "comments": {
            "$ref": "#/definitions/text_list"
        }
    },
    "required": [
        "familyname",
        "givennames"
    ],
    "additionalProperties": false,
    "definitions": {
        "text": {
            "anyOf": [
                {
                    "type": "number"
                },
                {
                    "type": "string",
                    "minLength": 1
                }
            ]
        },
        "text_list": {
            "type": "array",
            "elements": {
                "$ref": "#/definitions/text"
            },
            "minItems": 1,
            "_uniqueItems": true
        },
        "name_type": {
            "type": "string",
            "pattern": "^[^,\"]+$",
            "maxLength": 255
        },
        "ISO31661alpha3": {
            "type": "string",
            "pattern": "^(ABW|AFG|AGO|AIA|ALB|AND|ANT|ARE|ARG|ARM|ASM|ATA|ATF|ATG|AUS|AUT|AZE|BDI|BEL|BEN|BFA|BGD|BGR|BHR|BHS|BIH|BLR|BLZ|BMU|BOL|BRA|BRB|BRN|BTN|BVT|BWA|CAF|CAN|CCK|CHE|CHL|CHN|CIV|CMR|COD|COG|COK|COL|COM|CPV|CRI|CUB|CXR|CYM|CYP|CZE|DEU|DJI|DMA|DNK|DOM|DZA|ECU|EGY|ERI|ESH|ESP|EST|ETH|FIN|FJI|FLK|FRA|FRO|FSM|GAB|GBR|GEO|GGY|GHA|GIB|GIN|GLP|GMB|GNB|GNQ|GRC|GRD|GRL|GTM|GUF|GUM|GUY|HKG|HMD|HND|HRV|HTI|HUN|IDN|IMN|IND|IOT|IRL|IRN|IRQ|ISL|ISR|ITA|JAM|JEY|JOR|JPN|KAZ|KEN|KGZ|KHM|KIR|KNA|KOR|KWT|LAO|LBN|LBR|LBY|LCA|LIE|LKA|LSO|LTU|LUX|LVA|MAC|MAR|MCO|MDA|MDG|MDV|MEX|MHL|MKD|MLI|MLT|MMR|MNE|MNG|MNP|MOZ|MRT|MSR|MTQ|MUS|MWI|MYS|MYT|NAM|NCL|NER|NFK|NGA|NIC|NIU|NLD|NOR|NPL|NRU|NZL|OMN|PAK|PAN|PCN|PER|PHL|PLW|PNG|POL|PRI|PRK|PRT|PRY|PSE|PYF|QAT|REU|ROU|RUS|RWA|SAU|SDN|SEN|SGP|SGS|SHN|SJM|SLB|SLE|SLV|SMR|SOM|SPM|SRB|STP|SUR|SVK|SVN|SWE|SWZ|SYC|SYR|TCA|TCD|TGO|THA|TJK|TKL|TKM|TLS|TON|TTO|TUN|TUR|TUV|TWN|TZA|UGA|UKR|UMI|URY|USA|UZB|VAT|VCT|VEN|VGB|VIR|VNM|VUT|WLF|WSM|YEM|ZAF|ZMB|ZWE)$",
            "maxLength": 255
        },
        "foreignid_type": {
            "type": "object",
            "properties": {
                "domain": {
                    "type": "string",
                    "pattern": "^database\\.wfcc\\.ch$"
                },
                "id": {
                    "type": "integer",
                    "minimum": 1
                }
            },
            "required": [
                "domain",
                "id"
            ],
            "additionalProperties": false
        }
    }
}