{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "definitions": {
        "report": {
            "title": "Single report",
            "description": "Report configuration",
            "type": "object",
            "properties": {
                "id": {
                    "title": "Report ID",
                    "description": "Unique report identifier (UUID)",
                    "type": "string",
                    "minLength": 36,
                    "maxLength": 36
                },
                "model": {
                    "title": "Moden name",
                    "description": "Model from which the report is fetching the data",
                    "type": "string",
                    "minLength": 1
                },
                "widget_type": {
                    "title": "Widget type",
                    "description": "Type of widget used to render report",
                    "type": "string",
                    "enum": [
                        "report",
                        "grid"
                    ]
                },
                "name": {
                    "title": "Report name",
                    "description": "User-friendly report name",
                    "type": "string",
                    "minLength": 1
                },
                "query": {
                    "title": "SQL query",
                    "description": "SQL query which is used to fetch report data",
                    "type": "string",
                    "minLength": 1
                },
                "columns": {
                    "title": "Report columns",
                    "description": "Comma-separated list of fields from the query used in the report",
                    "type": "string",
                    "minLength": 1
                },
                "totals": {
                    "title": "Report totals",
                    "description": "Comma-separated index of columns with totals",
                    "type": "string"
                },
                "renderAs": {
                    "title": "Report rendering choice",
                    "description": "How the report should be rendered/presented",
                    "type": "string",
                    "enum": [
                        "barChart",
                        "donutChart",
                        "knobChart",
                        "lineChart",
                        "table",
                        "polarArea",
                        "pieChart",
                        "horizontalBar"
                    ]
                },
                "y_axis": {
                    "title": "Y-axis column",
                    "description": "Report column to use for the Y-axis (bar/line)",
                    "type": "string"
                },
                "x_axis": {
                    "title": "X-axis column",
                    "description": "Report column to use for the X-axis (bar/line)",
                    "type": "string"
                },
                "label": {
                    "title": "Report value label",
                    "description": "A single label for value in basic reports (knob/pie)",
                    "type": "string"
                },
                "value": {
                    "title": "Report value",
                    "description": "A single value for basic reports (knob/pie)",
                    "type": "string"
                },
                "max": {
                    "title": "Report value maximum",
                    "description": "A maximum for a single value in basic reports (knob)",
                    "type": "string"
                },
                "options": {
                    "title": "Other options",
                    "description": "Additional options for the chats",
                    "type": "object"
                },
                "finder": {
                    "title": "Cakephp ORM finder",
                    "description": "Custom Finder Methods",
                    "type": "object"
                }
            },
            "additionalProperties": false,
            "required": [
                "id",
                "model",
                "widget_type",
                "name",
                "columns"
            ]
        }
    },
    "title": "Reports configuration",
    "description": "Reports configuration options",
    "type": "object",
    "properties": {},
    "additionalProperties": {
        "allOf": [
            {
                "$ref": "#/definitions/report"
            }
        ]
    }
}