{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "id": "http://nase-skoly.cz/",
    "type": "object",
    "properties": {
        "RED-IZO": {
            "description": "The RED-IZO value given by M\u0160MT.",
            "type": "string"
        },
        "metadata": {
            "type": "object",
            "description": "Information about the school with fixed structure.",
            "$ref": "#/definitions/metadata"
        },
        "units": {
            "type": "array",
            "description": "Information about the units of the school",
            "items": {
                "type": "object",
                "$ref": "#/definitions/unit"
            }
        }
    },
    "required": [
        "RED-IZO",
        "metadata",
        "units"
    ],
    "definitions": {
        "address": {
            "properties": {
                "street": {
                    "type": "string"
                },
                "city": {
                    "type": "string"
                },
                "postalCode": {
                    "type": "string"
                },
                "region": {
                    "type": "string"
                },
                "location": {
                    "type": "object",
                    "description": "The geographical coordinates of the main school building or its unit.",
                    "properties": {
                        "lat": {
                            "type": "number"
                        },
                        "lon": {
                            "type": "number"
                        }
                    },
                    "required": [
                        "lat",
                        "lon"
                    ]
                },
                "googleId": {
                    "type": "string"
                }
            },
            "required": [
                "street",
                "city",
                "postalCode",
                "location"
            ]
        },
        "contact": {
            "type": "object",
            "properties": {
                "phoneNumbers": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "emails": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "websites": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            }
        },
        "metadata": {
            "type": "object",
            "properties": {
                "name": {
                    "description": "The name of the school or its unit.",
                    "type": "string"
                },
                "headmaster": {
                    "type": "object",
                    "description": "The information about the headmaster of the school or its unit.",
                    "properties": {
                        "name": {
                            "type": "string"
                        }
                    },
                    "required": [
                        "name"
                    ]
                },
                "contact": {
                    "type": "object",
                    "$ref": "#/definitions/contact"
                },
                "address": {
                    "type": "object",
                    "$ref": "#/definitions/address"
                }
            },
            "required": [
                "name",
                "address"
            ]
        },
        "unit": {
            "type": "object",
            "properties": {
                "IZO": {
                    "type": "string"
                },
                "unitType": {
                    "type": "string"
                },
                "metadata": {
                    "type": "object",
                    "$ref": "#/definitions/metadata"
                },
                "sections": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "$ref": "#/definitions/sections"
                    }
                }
            },
            "required": [
                "IZO",
                "unitType",
                "sections"
            ]
        },
        "sections": {
            "type": "object",
            "properties": {
                "title": {
                    "type": "string"
                },
                "information": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "$ref": "#/definitions/pieceOfInformation"
                    }
                }
            },
            "required": [
                "title",
                "information"
            ]
        },
        "pieceOfInformation": {
            "type": "object",
            "properties": {
                "key": {
                    "description": "The title of the piece of information.",
                    "type": "string"
                },
                "value": {
                    "description": "The textual value of the item.",
                    "type": "string"
                }
            },
            "required": [
                "key",
                "value"
            ]
        }
    }
}