{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.horusbi.com.br/schemas/v2/app-dashboard.schema.json",
  "title": "Lumo v2 app dashboard YAML",
  "type": "object",
  "required": [
    "header",
    "body"
  ],
  "properties": {
    "fileName": {
      "$ref": "shared.schema.json#/$defs/resourceFileName"
    },
    "header": {
      "allOf": [
        {
          "$ref": "shared.schema.json#/$defs/resourceHeaderBase"
        },
        {
          "type": "object",
          "required": [
            "id",
            "appId"
          ],
          "properties": {
            "kind": {
              "const": "app-dashboard"
            }
          }
        }
      ]
    },
    "body": {
      "allOf": [
        {
          "$ref": "shared.schema.json#/$defs/auditFields"
        },
        {
          "type": "object",
          "required": [
            "nome",
            "widgets"
          ],
          "properties": {
            "nome": {
              "type": "string",
              "minLength": 1
            },
            "ordem": {
              "type": "integer",
              "minimum": 0
            },
            "widget_columns": {
              "type": "integer",
              "minimum": 1
            },
            "widget_float": {
              "type": "boolean"
            },
            "version": {
              "$ref": "shared.schema.json#/$defs/readOnlyVersion"
            },
            "widgets": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "nome",
                  "type",
                  "x",
                  "y",
                  "w",
                  "h"
                ],
                "properties": {
                  "id": {
                    "$ref": "shared.schema.json#/$defs/id"
                  },
                  "guid": {
                    "type": "string",
                    "minLength": 1
                  },
                  "nome": {
                    "type": "string",
                    "minLength": 1
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "Kpi",
                      "LineChart",
                      "BarChart",
                      "AreaChart",
                      "PieChart",
                      "Table",
                      "Matrix",
                      "Gauge",
                      "Map",
                      "Text",
                      "Listbox",
                      "Calendar",
                      "Punchcard",
                      "Forecast",
                      "Diagram",
                      "CustomSvelte",
                      "Svelte",
                      "ParametricSvelte"
                    ]
                  },
                  "display_nome": {
                    "type": "boolean"
                  },
                  "x": {
                    "type": "number"
                  },
                  "y": {
                    "type": "number"
                  },
                  "w": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "h": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "chart": {
                    "$ref": "shared.schema.json#/$defs/freeformObject"
                  }
                },
                "additionalProperties": true
              }
            }
          },
          "additionalProperties": true
        }
      ]
    }
  },
  "additionalProperties": false
}
