{
    "$schema": "http://json-schema.org/schema#",
    "title": "ROK4 Services configuration",
    "type": "object",
    "additionalProperties": false,
    "properties": {
        "enabled": {
            "type": "boolean",
            "description": "Broadcast activation when all configuration is loaded",
            "default": true
        },
        "global": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "contact"
            ],
            "properties": {
                "provider": {
                    "type": "string",
                    "description": "Service provider"
                },
                "site": {
                    "type": "string",
                    "description": "Provider's website"
                },
                "fee": {
                    "type": "string",
                    "description": "Access costs"
                },
                "access_constraint": {
                    "type": "string",
                    "description": "Access conditions"
                },
                "crs_equivalences": {
                    "type": "string",
                    "description": "Path to JSON file with identical CRS (to avoid useless tranformation)"
                },
                "default_style": {
                    "type": "string",
                    "description": "Default style internal identifier",
                    "default": "normal"
                },
                "inspire": {
                    "type": "boolean",
                    "description": "Inspire mode as default response mode activation",
                    "default": false
                },
                "contact": {
                    "type": "object",
                    "additionalProperties": false,
                    "description": "Provider's contact informations",
                    "properties": {
                        "name": {
                            "type": "string"
                        },
                        "position": {
                            "type": "string"
                        },
                        "voice": {
                            "type": "string"
                        },
                        "facsimile": {
                            "type": "string"
                        },
                        "address_type": {
                            "type": "string"
                        },
                        "delivery_point": {
                            "type": "string"
                        },
                        "city": {
                            "type": "string"
                        },
                        "administrative_area": {
                            "type": "string"
                        },
                        "post_code": {
                            "type": "string"
                        },
                        "country": {
                            "type": "string"
                        },
                        "email": {
                            "type": "string"
                        }
                    }
                },
                "tile": {
                    "type": "object",
                    "additionalProperties": false,
                    "description": "Configuration for tile broadcast (WMT, TMS and OGC API Tiles)",
                    "properties": {
                        "reprojection": {
                            "type": "boolean",
                            "default": false,
                            "description": "WMTS reprojection activation"
                        }
                    }
                },
                "map": {
                    "type": "object",
                    "additionalProperties": false,
                    "description": "Configuration for map broadcast (WMS and OGC API Maps)",
                    "properties": {
                        "formats": {
                            "type": "array",
                            "items": {
                                "type": "string",
                                "enum": [
                                    "image/jpeg",
                                    "image/png",
                                    "image/tiff",
                                    "image/geotiff",
                                    "image/x-bil;bits=32",
                                    "text/asc"
                                ]
                            },
                            "description": "WMS handled raster formats",
                            "default": [
                                "image/jpeg",
                                "image/png",
                                "image/tiff",
                                "image/geotiff",
                                "image/x-bil;bits=32"
                            ]
                        },
                        "limits": {
                            "type": "object",
                            "additionalProperties": false,
                            "properties": {
                                "layers_count": {
                                    "type": "integer",
                                    "description": "Maximum layers count in a WMS GetMap",
                                    "minimum": 1,
                                    "default": 1
                                },
                                "width": {
                                    "type": "integer",
                                    "description": "Maximum width in a WMS GetMap",
                                    "minimum": 1,
                                    "default": 5000
                                },
                                "height": {
                                    "type": "integer",
                                    "description": "Maximum height in a WMS GetMap",
                                    "minimum": 1,
                                    "default": 5000
                                },
                                "tile_x": {
                                    "type": "integer",
                                    "description": "Maximum source tiles count widthwise to build the response of a WMS GetMap",
                                    "minimum": 1,
                                    "default": 32
                                },
                                "tile_y": {
                                    "type": "integer",
                                    "description": "Maximum source tiles count heightwise to build the response of a WMS GetMap",
                                    "minimum": 1,
                                    "default": 32
                                }
                            }
                        },
                        "crs": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            },
                            "description": "WMS global handled CRS"
                        },
                        "reprojection": {
                            "type": "boolean",
                            "default": false,
                            "description": "WMS reprojection activation"
                        }
                    }
                }
            }
        },
        "health": {
            "type": "object",
            "additionalProperties": false,
            "description": "Health API configuration",
            "properties": {
                "enabled": {
                    "type": "boolean",
                    "default": false,
                    "description": "Health API activation"
                }
            }
        },
        "admin": {
            "type": "object",
            "additionalProperties": false,
            "description": "Administration API configuration",
            "properties": {
                "enabled": {
                    "type": "boolean",
                    "default": false,
                    "description": "Administration API activation"
                },
                "secret": {
                    "type": "string",
                    "description": "Secret token to use the administration API, no security if not provided or empty string"
                }
            }
        },
        "wms": {
            "type": "object",
            "additionalProperties": false,
            "description": "WMS API configuration",
            "properties": {
                "enabled": {
                    "type": "boolean",
                    "default": false,
                    "description": "WMS API activation"
                },
                "name": {
                    "type": "string",
                    "description": "WMS API name",
                    "default": "WMS"
                },
                "title": {
                    "type": "string",
                    "description": "WMS API title",
                    "default": "WMS service"
                },
                "abstract": {
                    "type": "string",
                    "description": "WMS API abstract",
                    "default": "WMS service"
                },
                "endpoint_uri": {
                    "type": "string",
                    "description": "WMS API public endpoint",
                    "default": "http://localhost/wms"
                },
                "root_path": {
                    "type": "string",
                    "description": "WMS API internal path",
                    "default": "/wms"
                },
                "keywords": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "description": "WMS API keywords"
                },
                "metadata": {
                    "$ref": "#/$defs/metadata",
                    "description": "WMS service's metadata"
                },
                "root_layer": {
                    "type": "object",
                    "additionalProperties": false,
                    "description": "WMS root layer description",
                    "properties": {
                        "title": {
                            "type": "string",
                            "default": "WMS layers"
                        },
                        "abstract": {
                            "type": "string",
                            "default": "WMS layers"
                        }
                    }
                }
            }
        },
        "wmts": {
            "type": "object",
            "additionalProperties": false,
            "description": "WMTS API configuration",
            "properties": {
                "enabled": {
                    "type": "boolean",
                    "default": false,
                    "description": "WMTS API activation"
                },
                "title": {
                    "type": "string",
                    "description": "WMTS API title",
                    "default": "WMTS service"
                },
                "abstract": {
                    "type": "string",
                    "description": "WMTS API abstract",
                    "default": "WMTS service"
                },
                "endpoint_uri": {
                    "type": "string",
                    "description": "WMTS API public endpoint",
                    "default": "http://localhost/wmts"
                },
                "root_path": {
                    "type": "string",
                    "description": "WMTS API internal path",
                    "default": "/wmts"
                },
                "keywords": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "description": "WMTS API keywords"
                },
                "metadata": {
                    "$ref": "#/$defs/metadata",
                    "description": "WMTS service's metadata"
                }
            }
        },
        "tms": {
            "type": "object",
            "additionalProperties": false,
            "description": "TMS API configuration",
            "properties": {
                "enabled": {
                    "type": "boolean",
                    "default": false,
                    "description": "TMS API activation"
                },
                "title": {
                    "type": "string",
                    "description": "TMS API title",
                    "default": "TMS service"
                },
                "abstract": {
                    "type": "string",
                    "description": "TMS API abstract",
                    "default": "TMS service"
                },
                "endpoint_uri": {
                    "type": "string",
                    "description": "TMS API public endpoint",
                    "default": "http://localhost/tms"
                },
                "root_path": {
                    "type": "string",
                    "description": "TMS API internal path",
                    "default": "/tms"
                },
                "keywords": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "description": "TMS API keywords"
                },
                "metadata": {
                    "$ref": "#/$defs/metadata",
                    "description": "TMS service's metadata"
                }
            }
        },
        "ogcapi": {
            "type": "object",
            "additionalProperties": false,
            "description": "OGC API configuration",
            "properties": {
                "enabled": {
                    "type": "boolean",
                    "default": false,
                    "description": "OGC API activation"
                },
                "title": {
                    "type": "string",
                    "description": "OGC API title",
                    "default": "OGC API service"
                },
                "abstract": {
                    "type": "string",
                    "description": "OGC API abstract",
                    "default": "OGC API service"
                },
                "endpoint_uri": {
                    "type": "string",
                    "description": "OGC API public endpoint",
                    "default": "http://localhost/ogcapi"
                },
                "root_path": {
                    "type": "string",
                    "description": "OGC API internal path",
                    "default": "/ogcapi"
                },
                "keywords": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "description": "OGC API keywords"
                },
                "metadata": {
                    "$ref": "#/$defs/metadata",
                    "description": "OGC API service's metadata"
                },
                "tiles": {
                    "type": "boolean",
                    "default": true,
                    "description": "OGC API Tiles activation"
                },
                "maps": {
                    "type": "boolean",
                    "default": true,
                    "description": "OGC API Maps activation"
                },
                "default_size": {
                    "type": "integer",
                    "minimum": 64,
                    "maximum": 4096,
                    "default": 256,
                    "description": "Default dimension (width or height) for API Maps"
                }
            }
        }
    },
    "$defs": {
        "metadata": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "format",
                "type",
                "url"
            ],
            "properties": {
                "format": {
                    "type": "string",
                    "default": "WMS service"
                },
                "type": {
                    "type": "string",
                    "default": "WMS service"
                },
                "url": {
                    "type": "string",
                    "default": "WMS service"
                }
            }
        }
    }
}