{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Schema for js-entity-modeling example",
    "type": "object",
    "properties": {
        "users": {
            "description": "KEY - user.uid",
            "type": "object",
            "additionalProperties": {
                "$ref": "#/definitions/user"
            }
        }
    },
    "additionalProperties": false,
    "definitions": {
        "user": {
            "description": "Private User Data",
            "type": "object",
            "properties": {
                "uid": {
                    "description": "Firebase User ID",
                    "type": "string"
                },
                "name": {
                    "$ref": "#/definitions/name_token"
                },
                "email": {
                    "description": "User's Email Address",
                    "type": "string",
                    "format": "email"
                },
                "address": {
                    "$ref": "#/definitions/location"
                }
            },
            "required": [
                "uid",
                "name",
                "email",
                "address"
            ],
            "additionalProperties": false
        },
        "location": {
            "description": "Location Descriptor",
            "type": "object",
            "properties": {
                "address": {
                    "description": "Street Address",
                    "type": "string"
                },
                "city": {
                    "description": "City",
                    "type": "string"
                },
                "state": {
                    "description": "State",
                    "type": "string"
                },
                "postcode": {
                    "description": "Postal Code",
                    "type": "string"
                },
                "country": {
                    "description": "Country",
                    "type": "string"
                },
                "latitude": {
                    "description": "Latitude",
                    "type": "number"
                },
                "longitude": {
                    "description": "Longitude",
                    "type": "number"
                },
                "neigborhood": {
                    "description": "Neighborhood Name",
                    "type": "string"
                }
            },
            "required": [
                "address",
                "city",
                "state",
                "postcode",
                "country",
                "latitude"
            ],
            "additionalProperties": false
        },
        "user_token": {
            "description": "Token Value to Represent a User",
            "type": "object",
            "properties": {
                "uid": {
                    "description": "User's ID",
                    "type": "string"
                },
                "name": {
                    "$ref": "#/definitions/name_token"
                },
                "photo": {
                    "description": "User Photo",
                    "type": "string",
                    "format": "uri"
                }
            },
            "required": [
                "uid",
                "name"
            ],
            "additionalProperties": false
        },
        "name_token": {
            "description": "Token Value to Represent a User Name",
            "type": "object",
            "properties": {
                "display": {
                    "description": "Display Name",
                    "type": "string"
                },
                "first": {
                    "description": "Optional First Name",
                    "type": "string"
                },
                "last": {
                    "description": "Optional Last Name",
                    "type": "string"
                }
            },
            "required": [
                "display"
            ],
            "additionalProperties": false
        }
    }
}