{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.appmost.ai/format/schemas/2.0/page.schema.json",
  "title": "Appmost Project Format 2.0 page",
  "type": "object",
  "required": ["id", "type"],
  "properties": {
    "id": { "type": "string", "minLength": 1 },
    "type": {
      "enum": ["normal", "tabbar", "paginated", "webview", "map", "camera", "login", "bankIdLogin", "none"]
    },
    "rows": {
      "type": "array",
      "items": { "$ref": "#/$defs/row" }
    },
    "extensions": { "$ref": "#/$defs/extensions" }
  },
  "additionalProperties": true,
  "$defs": {
    "extensions": {
      "type": "object",
      "propertyNames": { "pattern": "^[a-z0-9.-]+/[a-zA-Z0-9._-]+$" }
    },
    "action": {
      "type": "object",
      "required": ["type"],
      "properties": {
        "type": { "type": "string", "minLength": 1 },
        "configuration": { "type": "object" },
        "extensions": { "$ref": "#/$defs/extensions" }
      },
      "additionalProperties": true
    },
    "row": {
      "type": "object",
      "required": ["id", "type"],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "type": { "type": "string", "minLength": 1 },
        "role": { "enum": ["header", "defaultHeader", "footer"] },
        "appActions": {
          "type": "array",
          "items": { "$ref": "#/$defs/action" }
        },
        "chartViewModels": {
          "type": "array",
          "items": { "$ref": "#/$defs/chartViewModel" }
        },
        "childProperties": {
          "type": "object",
          "properties": {
            "children": {
              "type": "array",
              "items": { "$ref": "#/$defs/row" }
            }
          },
          "additionalProperties": true
        },
        "extensions": { "$ref": "#/$defs/extensions" }
      },
      "additionalProperties": true
    },
    "chartDataPoint": {
      "type": "object",
      "required": ["label", "value"],
      "properties": {
        "label": { "type": "string" },
        "value": { "type": "number" },
        "minValue": { "type": "number" },
        "maxValue": { "type": "number" },
        "extensions": { "$ref": "#/$defs/extensions" }
      },
      "additionalProperties": true
    },
    "chartViewModel": {
      "type": "object",
      "properties": {
        "chartStyle": {
          "enum": ["standard", "compactTrend", "sparkline", "metricInline"]
        },
        "usesCustomChartStyle": { "type": "boolean" },
        "showYAxis": { "type": "boolean" },
        "showXAxis": { "type": "boolean" },
        "tintColor": { "type": ["object", "null"] },
        "highlightLargestBar": { "type": "boolean" },
        "barTopCornerRadius": { "type": "integer", "minimum": 0 },
        "usesGradient": { "type": "boolean" },
        "lineWidth": { "type": "number", "exclusiveMinimum": 0 },
        "showGridLines": { "type": "boolean" },
        "showSymbols": { "type": "boolean" },
        "yAxisPosition": { "enum": ["leading", "trailing"] },
        "interpolation": {
          "enum": ["linear", "monotone", "catmullRom", "cardinal", "stepStart", "stepCenter", "stepEnd"]
        },
        "dataPoints": {
          "type": "array",
          "items": { "$ref": "#/$defs/chartDataPoint" }
        },
        "extensions": { "$ref": "#/$defs/extensions" }
      },
      "additionalProperties": true
    }
  }
}
