{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$ref": "#/definitions/PlaceData",
    "definitions": {
        "IPlaceData": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "alternateNames": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "location": {
                    "$ref": "#/definitions/Location"
                },
                "locationKnown": {
                    "type": "boolean"
                },
                "checked": {
                    "type": "boolean"
                },
                "checkedBy": {
                    "type": "string"
                },
                "spelioData": {
                    "$ref": "#/definitions/SpelioData"
                },
                "diveData": {
                    "anyOf": [
                        {
                            "$ref": "#/definitions/DiveData"
                        },
                        {
                            "type": "null"
                        }
                    ]
                }
            },
            "required": ["name", "location", "locationKnown", "checked", "spelioData"],
            "additionalProperties": false
        },
        "Location": {
            "type": "object",
            "properties": {
                "lat": {
                    "type": "number"
                },
                "lon": {
                    "type": "number"
                }
            },
            "required": ["lat", "lon"],
            "additionalProperties": false
        },
        "SpelioData": {
            "type": "object",
            "properties": {
                "type": {
                    "anyOf": [
                        {
                            "$ref": "#/definitions/LocationType"
                        },
                        {
                            "type": "string",
                            "const": "UNKNOWN"
                        },
                        {
                            "type": "string",
                            "const": "NOT_FOUND"
                        },
                        {
                            "type": "string",
                            "const": "DEPRESSION"
                        },
                        {
                            "type": "string",
                            "const": "CAVE"
                        },
                        {
                            "type": "string",
                            "const": "SINKHOLE"
                        },
                        {
                            "type": "string",
                            "const": "SOLUTION_TUBE"
                        },
                        {
                            "type": "string",
                            "const": "DESTROYED"
                        },
                        {
                            "type": "string",
                            "const": "ROCKY_OUTCROP"
                        },
                        {
                            "type": "string",
                            "const": "LANDMARK"
                        },
                        {
                            "type": "string",
                            "const": "MINE"
                        }
                    ]
                },
                "source": {
                    "type": "string"
                },
                "reference": {
                    "type": "string"
                },
                "notes": {
                    "type": "string"
                },
                "tourismPotential": {
                    "anyOf": [
                        {
                            "$ref": "#/definitions/TourismPotential"
                        },
                        {
                            "type": "string",
                            "const": "UNKNOWN"
                        },
                        {
                            "type": "string",
                            "const": "NONE"
                        },
                        {
                            "type": "string",
                            "const": "LOW"
                        },
                        {
                            "type": "string",
                            "const": "MEDIUM"
                        },
                        {
                            "type": "string",
                            "const": "HIGH"
                        }
                    ]
                },
                "accessDetails": {
                    "type": "string"
                },
                "verticalAccess": {
                    "anyOf": [
                        {
                            "$ref": "#/definitions/TriState"
                        },
                        {
                            "type": "string",
                            "const": "UNKNOWN"
                        },
                        {
                            "type": "string",
                            "const": "NO"
                        },
                        {
                            "type": "string",
                            "const": "YES"
                        }
                    ]
                },
                "caveRating": {
                    "anyOf": [
                        {
                            "$ref": "#/definitions/CaveRating"
                        },
                        {
                            "type": "string",
                            "const": "UNKNOWN"
                        },
                        {
                            "type": "string",
                            "const": "NONE"
                        },
                        {
                            "type": "string",
                            "const": "OPEN_WATER"
                        },
                        {
                            "type": "string",
                            "const": "BASIC"
                        },
                        {
                            "type": "string",
                            "const": "CAVE"
                        },
                        {
                            "type": "string",
                            "const": "ADVANCED"
                        }
                    ]
                },
                "highestCaveRating": {
                    "anyOf": [
                        {
                            "$ref": "#/definitions/CaveRating"
                        },
                        {
                            "type": "string",
                            "const": "UNKNOWN"
                        },
                        {
                            "type": "string",
                            "const": "NONE"
                        },
                        {
                            "type": "string",
                            "const": "OPEN_WATER"
                        },
                        {
                            "type": "string",
                            "const": "BASIC"
                        },
                        {
                            "type": "string",
                            "const": "CAVE"
                        },
                        {
                            "type": "string",
                            "const": "ADVANCED"
                        },
                        {
                            "type": "null"
                        }
                    ]
                },
                "explorationPotential": {
                    "anyOf": [
                        {
                            "$ref": "#/definitions/ExplorationPotential"
                        },
                        {
                            "type": "string",
                            "const": "UNKNOWN"
                        },
                        {
                            "type": "string",
                            "const": "NONE"
                        },
                        {
                            "type": "string",
                            "const": "LOW"
                        },
                        {
                            "type": "string",
                            "const": "MEDIUM"
                        },
                        {
                            "type": "string",
                            "const": "HIGH"
                        },
                        {
                            "type": "string",
                            "const": "VERY_HIGH"
                        }
                    ]
                },
                "disabledAccessPotential": {
                    "anyOf": [
                        {
                            "$ref": "#/definitions/DisabledAccessPotential"
                        },
                        {
                            "type": "string",
                            "const": "UNKNOWN"
                        },
                        {
                            "type": "string",
                            "const": "NONE"
                        },
                        {
                            "type": "string",
                            "const": "LOW"
                        },
                        {
                            "type": "string",
                            "const": "MEDIUM"
                        },
                        {
                            "type": "string",
                            "const": "HIGH"
                        }
                    ]
                },
                "files": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "labels": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "goesToWater": {
                    "anyOf": [
                        {
                            "$ref": "#/definitions/TriState"
                        },
                        {
                            "type": "string",
                            "const": "UNKNOWN"
                        },
                        {
                            "type": "string",
                            "const": "NO"
                        },
                        {
                            "type": "string",
                            "const": "YES"
                        }
                    ]
                },
                "references": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/IReference"
                    }
                },
                "systemName": {
                    "type": ["string", "null"]
                }
            },
            "required": ["type"],
            "additionalProperties": false
        },
        "LocationType": {
            "type": "string",
            "enum": [
                "Unknown",
                "NotFound",
                "Depression",
                "Cave",
                "Sinkhole",
                "SolutionTube",
                "Destroyed",
                "RockyOutcrop",
                "Landmark",
                "Mine"
            ]
        },
        "TourismPotential": {
            "type": "string",
            "enum": ["Unknown", "None", "Low", "Medium", "High"]
        },
        "TriState": {
            "type": "string",
            "enum": ["Unknown", "No", "Yes"]
        },
        "CaveRating": {
            "type": "string",
            "enum": ["Unknown", "None", "OpenWater", "Basic", "Cave", "Advanced"]
        },
        "ExplorationPotential": {
            "type": "string",
            "enum": ["Unknown", "None", "Low", "Medium", "High", "VeryHigh"]
        },
        "DisabledAccessPotential": {
            "type": "string",
            "enum": ["Unknown", "None", "Low", "Medium", "High"]
        },
        "IReference": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string"
                },
                "text": {
                    "type": "string"
                }
            },
            "required": ["name", "text"],
            "additionalProperties": false
        },
        "DiveData": {
            "type": "object",
            "properties": {
                "maxDepth": {
                    "type": ["number", "null"]
                },
                "minTemp": {
                    "type": ["number", "null"]
                },
                "maxTemp": {
                    "type": ["number", "null"]
                },
                "waterType": {
                    "anyOf": [
                        {
                            "$ref": "#/definitions/WaterType"
                        },
                        {
                            "type": "string",
                            "const": "UNKNOWN"
                        },
                        {
                            "type": "string",
                            "const": "FRESH"
                        },
                        {
                            "type": "string",
                            "const": "SALT"
                        }
                    ]
                },
                "isTidal": {
                    "anyOf": [
                        {
                            "$ref": "#/definitions/TriState"
                        },
                        {
                            "type": "string",
                            "const": "UNKNOWN"
                        },
                        {
                            "type": "string",
                            "const": "NO"
                        },
                        {
                            "type": "string",
                            "const": "YES"
                        }
                    ]
                }
            },
            "required": ["waterType", "isTidal"],
            "additionalProperties": false
        },
        "WaterType": {
            "type": "string",
            "enum": ["Unknown", "Fresh", "Salt"]
        }
    }
}
