{
    "title": "List enduser reply v1",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "https://api.nextpertise.nl/schemas/enduser/list_endusers_reply_v1.json",
    "type": "object",
    "properties": {
        "endusers": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "uuid": {
                        "type": "string"
                    },
                    "company_name": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "phonenumber": {
                        "title": "Telephone number",
                        "description": "Dutch national telephone number",
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^0([1-7][0-9]|85|88)[0-9]{7}$"
                    },
                    "address": {
                        "title": "Extended address",
                        "description": "A complete address with province, municipality, latitude and longitude.",
                        "allOf": [
                            {
                                "title": "Location",
                                "description": "Defines a location through zipcode/housenr combination.",
                                "type": "object",
                                "properties": {
                                    "zipcode": {
                                        "title": "Zipcode",
                                        "description": "The zipcode must conform to the Dutch postcode format. Note that the initial digit is not allowed to be '0' unless when testing.",
                                        "type": "string",
                                        "pattern": "^[0-9]{4}[A-Z]{2}$"
                                    },
                                    "housenr": {
                                        "title": "House number",
                                        "description": "The house number that with the zipcode identifies an address.",
                                        "type": "number",
                                        "maximum": 99999
                                    },
                                    "housenrext": {
                                        "title": "Extended house number",
                                        "description": "House number suffix.",
                                        "type": [
                                            "string",
                                            "null"
                                        ],
                                        "maxLength": 10
                                    }
                                },
                                "required": [
                                    "housenr",
                                    "zipcode"
                                ]
                            },
                            {
                                "title": "Extended location",
                                "description": "Extends a location with street and city references.",
                                "type": "object",
                                "properties": {
                                    "street": {
                                        "description": "The street name.",
                                        "title": "Optional string",
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "city": {
                                        "description": "The city name.",
                                        "title": "Optional string",
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "street",
                                    "city"
                                ]
                            },
                            {
                                "type": "object",
                                "properties": {
                                    "province": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "municipality": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "latitude": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    "longitude": {
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                },
                                "required": [
                                    "province",
                                    "municipality",
                                    "latitude",
                                    "longitude"
                                ]
                            }
                        ],
                        "type": "all of"
                    }
                },
                "additionalProperties": false
            }
        }
    },
    "additionalProperties": false,
    "required": [
        "endusers"
    ]
}