{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "definitions": {
        "sequence": {
            "type": "number",
            "description": "the sequence of this node (i.e. its order within its siblings)"
        },
        "location": {
            "type": "object",
            "description": "the geographic coordinates of this value, which represents a physical location. This may be present only when (a) the category itself has key of LOCATION, and (b) the value is a leaf (has no children)",
            "properties": {
                "lat": {
                    "type": "number",
                    "description": "latitude of this location"
                },
                "lng": {
                    "type": "number",
                    "description": "longitude of this location"
                },
                "country": {
                    "description": "country, in ISO 3166-1 alpha-2 form",
                    "enum": [
                        "AC",
                        "AD",
                        "AE",
                        "AF",
                        "AG",
                        "AI",
                        "AL",
                        "AM",
                        "AN",
                        "AO",
                        "AQ",
                        "AR",
                        "AS",
                        "AT",
                        "AU",
                        "AW",
                        "AX",
                        "AZ",
                        "BA",
                        "BB",
                        "BD",
                        "BE",
                        "BF",
                        "BG",
                        "BH",
                        "BI",
                        "BJ",
                        "BM",
                        "BN",
                        "BO",
                        "BR",
                        "BS",
                        "BT",
                        "BV",
                        "BW",
                        "BY",
                        "BZ",
                        "CA",
                        "CC",
                        "CD",
                        "CF",
                        "CG",
                        "CH",
                        "CI",
                        "CK",
                        "CL",
                        "CM",
                        "CN",
                        "CO",
                        "CR",
                        "CU",
                        "CV",
                        "CX",
                        "CY",
                        "CZ",
                        "DE",
                        "DJ",
                        "DK",
                        "DM",
                        "DO",
                        "DZ",
                        "EC",
                        "EE",
                        "EG",
                        "ER",
                        "ES",
                        "ET",
                        "FI",
                        "FJ",
                        "FK",
                        "FM",
                        "FO",
                        "FR",
                        "GA",
                        "GB",
                        "GD",
                        "GE",
                        "GF",
                        "GG",
                        "GH",
                        "GI",
                        "GL",
                        "GM",
                        "GN",
                        "GP",
                        "GQ",
                        "GR",
                        "GS",
                        "GT",
                        "GU",
                        "GW",
                        "GY",
                        "HK",
                        "HM",
                        "HN",
                        "HR",
                        "HT",
                        "HU",
                        "ID",
                        "IE",
                        "IL",
                        "IM",
                        "IN",
                        "IO",
                        "IQ",
                        "IR",
                        "IS",
                        "IT",
                        "JE",
                        "JM",
                        "JO",
                        "JP",
                        "KE",
                        "KG",
                        "KH",
                        "KI",
                        "KM",
                        "KN",
                        "KP",
                        "KR",
                        "KW",
                        "KY",
                        "KZ",
                        "LA",
                        "LB",
                        "LC",
                        "LI",
                        "LK",
                        "LR",
                        "LS",
                        "LT",
                        "LU",
                        "LV",
                        "LY",
                        "MA",
                        "MC",
                        "MD",
                        "ME",
                        "MG",
                        "MH",
                        "MK",
                        "ML",
                        "MM",
                        "MN",
                        "MO",
                        "MP",
                        "MQ",
                        "MR",
                        "MS",
                        "MT",
                        "MU",
                        "MV",
                        "MW",
                        "MX",
                        "MY",
                        "MZ",
                        "NA",
                        "NC",
                        "NE",
                        "NF",
                        "NG",
                        "NI",
                        "NL",
                        "NO",
                        "NP",
                        "NR",
                        "NU",
                        "NZ",
                        "OM",
                        "PA",
                        "PE",
                        "PF",
                        "PG",
                        "PH",
                        "PK",
                        "PL",
                        "PM",
                        "PN",
                        "PR",
                        "PT",
                        "PW",
                        "PY",
                        "QA",
                        "RE",
                        "RO",
                        "RS",
                        "RU",
                        "RW",
                        "SA",
                        "SB",
                        "SC",
                        "SD",
                        "SE",
                        "SG",
                        "SH",
                        "SI",
                        "SJ",
                        "SK",
                        "SL",
                        "SM",
                        "SN",
                        "SO",
                        "SR",
                        "ST",
                        "SV",
                        "SY",
                        "SZ",
                        "TA",
                        "TC",
                        "TD",
                        "TF",
                        "TG",
                        "TH",
                        "TJ",
                        "TK",
                        "TL",
                        "TM",
                        "TN",
                        "TO",
                        "TR",
                        "TT",
                        "TV",
                        "TW",
                        "TZ",
                        "UA",
                        "UG",
                        "UM",
                        "US",
                        "UY",
                        "UZ",
                        "VA",
                        "VC",
                        "VE",
                        "VG",
                        "VI",
                        "VN",
                        "VU",
                        "WF",
                        "WS",
                        "YE",
                        "YT",
                        "ZA",
                        "ZM",
                        "ZW"
                    ]
                }
            },
            "required": [
                "lat",
                "lng"
            ]
        },
        "externalId": {
            "type": "string",
            "description": "An immutable external identifier, e.g. primary key in an upstream system, used to identify the category value"
        },
        "parent": {
            "type": "integer",
            "description": "The id of the value which is this node's parent (hierarchical structure)"
        },
        "remappedTo": {
            "type": "integer",
            "description": "The id of the value which took over from this node, when this node was permanently inactivated"
        }
    },
    "type": "object",
    "description": "details of a single category value",
    "properties": {
        "id": {
            "type": "integer"
        },
        "available": {
            "type": "boolean",
            "description": "whether this node can be selected (i.e. is not disabled)"
        },
        "name": {
            "type": "string",
            "description": "the user visible name for this category value"
        },
        "code": {
            "type": "string",
            "description": "a code for this category value"
        },
        "externalId": {
            "$ref": "#/definitions/externalId"
        },
        "sequence": {
            "$ref": "#/definitions/sequence"
        },
        "parent": {
            "$ref": "#/definitions/parent"
        },
        "remappedTo": {
            "$ref": "#/definitions/remappedTo"
        },
        "location": {
            "$ref": "#/definitions/location"
        },
        "values": {
            "type": "array",
            "items": {
                "$ref": "#"
            }
        }
    },
    "additionalProperties": false
}