{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
        "featureTypes": {
            "type": "object",
            "patternProperties": {
                "^[\\w\\.\\d\\_]+$": {
                    "type": "object",
                    "properties": {
                        "name": {
                            "type": "string",
                            "description": "How the name the feature type, same as the property name."
                        },
                        "style": {
                            "type": "object",
                            "properties": {
                                "fillColor": {
                                    "type": "string",
                                    "pattern": "^#[a-fA-F0-9]{6}$",
                                    "description": "Color to use to fill the icon."
                                },
                                "strokeColor": {
                                    "type": "string",
                                    "pattern": "^#\\d{6}",
                                    "description": "Color to use for the stroke around the icon."
                                },
                                "drawingMode": {
                                    "type": "string",
                                    "enum": [
                                        "Point",
                                        "Polyline",
                                        "Polygon",
                                        "MultiPolygon"
                                    ],
                                    "description": "How to render the icon, if any."
                                },
                                "strokeWidth": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "description": "Stroke width in pixels."
                                },
                                "iconWidth": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "description": "Icon width in pixels."
                                },
                                "iconHeight": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "description": "Icon height in pixels."
                                },
                                "iconUri": {
                                    "type": "string",
                                    "description": "URL of the image icon. Is not only used for point features, but also for polygons to recognize them in the legend and when showing the feature's properties. May optionally contain a matching pair of braces, which is replaced with the corresponding property value."
                                },
                                "nameLabel": {
                                    "type": "string",
                                    "description": "Property to use as the Name or title."
                                },
                                "maxTitleResolution": {
                                    "type": "integer",
                                    "minimum": -1,
                                    "maximum": 23,
                                    "description": "At what zoom level should we stop showing the title. When zooming further out beyond this level, the title is no longer shown."
                                }
                            },
                            "required": [
                                "fillColor",
                                "strokeColor",
                                "drawingMode",
                                "strokeWidth",
                                "iconWidth",
                                "iconHeight",
                                "iconUri",
                                "nameLabel",
                                "maxTitleResolution"
                            ]
                        },
                        "propertyTypeKeys": {
                            "type": "string",
                            "description": "An ordered, semi-colon separated list of all property data keys to display when selecting the feature."
                        },
                        "legendExpr": {
                            "type": "array",
                            "description": "In the legend, show a summary of this feature.",
                            "items": {
                                "type": "object",
                                "properties": {
                                    "title": {
                                        "type": "string",
                                        "description": "Display name in the legend."
                                    },
                                    "type": {
                                        "enum": [
                                            "text",
                                            "textarea",
                                            "textarea-right",
                                            "boolean",
                                            "number",
                                            "bbcode",
                                            "options",
                                            "rank",
                                            "hierarchy",
                                            "date",
                                            "duration"
                                        ],
                                        "description": "Default display type is text."
                                    },
                                    "stringFormat": {
                                        "type": "string",
                                        "description": "A string that represents the .NET formatting to use for displaying the property value, e.g. {0:0,000.##} to show a thousand separator as well as up to two decimals."
                                    },
                                    "expression": {
                                        "type": "string",
                                        "description": "A formula that is computed upon loading the layer, and when the map's extent (bounding box) is changed. E.g. \"sum(features, 'NR_PEOPLE')\" sums the number of people within the extent of the map."
                                    }
                                },
                                "required": [
                                    "title",
                                    "type",
                                    "stringFormat",
                                    "expression"
                                ]
                            }
                        }
                    },
                    "required": [
                        "name",
                        "style",
                        "propertyTypeKeys",
                        "legendExpr"
                    ]
                }
            },
            "additionalProperties": false
        },
        "propertyTypeData": {
            "type": "object",
            "description": "A list of property types, which specify how each feature's property should be displayed.",
            "patternProperties": {
                "^[\\w\\.\\d\\_]+$": {
                    "type": "object",
                    "properties": {
                        "title": {
                            "type": "string",
                            "description": "Display name in the legend."
                        },
                        "type": {
                            "enum": [
                                "text",
                                "textarea",
                                "boolean",
                                "number",
                                "bbcode",
                                "options",
                                "rank",
                                "hierarchy",
                                "date",
                                "duration"
                            ],
                            "description": "Default display type is text."
                        },
                        "stringFormat": {
                            "type": "string",
                            "description": "A string that represents the .NET formatting to use for displaying the property value, e.g. {0:0,000.##} to show a thousand separator as well as up to two decimals."
                        },
                        "expression": {
                            "type": "string",
                            "title": "Expression or formula",
                            "description": "A formula that is computed upon loading the layer. E.g. \"properties.p_00_14_jr * properties.nr_people / 100\" converts the percentage of children to an absolute number."
                        },
                        "section": {
                            "type": "string",
                            "description": "Separate the properties by placing each of them in their own section."
                        },
                        "visibleInCallOut": {
                            "type": "boolean",
                            "description": "If true (default), show the property when the feature is selected."
                        },
                        "label": {
                            "type": "string",
                            "description": "Property label, which is typically the same as this item's key. It is still useful, however, when you wish to display a property twice, each time using a different display format, e.g. text and link, or year and date separately."
                        }
                    }
                }
            }
        }
    }
}