{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://bsgtechnologies.com/schemas/hyper-react-xml.schema.json",
  "title": "HyperReactXML Screen",
  "description": "Attribute reference for HyperReactXML XML screen definitions.",
  "type": "object",
  "properties": {
    "commonAttributes": {
      "$ref": "#/$defs/commonAttributes"
    },
    "tags": {
      "type": "array",
      "items": {
        "enum": [
          "Page",
          "Card",
          "Form",
          "Grid",
          "Row",
          "Col",
          "Input",
          "Textarea",
          "Select",
          "Checkbox",
          "Radio",
          "DatePicker",
          "Button",
          "Modal",
          "Tabs",
          "Tab",
          "Table",
          "Column",
          "Action",
          "BulkAction",
          "Badge",
          "Alert",
          "Divider",
          "Text",
          "Heading"
        ]
      }
    }
  },
  "$defs": {
    "commonAttributes": {
      "type": "object",
      "properties": {
        "permission": {
          "type": "string",
          "description": "Permission required before the node renders."
        },
        "showWhen": {
          "type": "string",
          "description": "Conditional expression such as status=ACTIVE, age>=18, role=ADMIN && status=ACTIVE."
        },
        "disabledWhen": {
          "type": "string",
          "description": "Conditional expression that disables fields or buttons."
        },
        "readOnlyWhen": {
          "type": "string",
          "description": "Conditional expression that makes text inputs read-only."
        }
      }
    },
    "fieldAttributes": {
      "allOf": [
        {
          "$ref": "#/$defs/commonAttributes"
        },
        {
          "type": "object",
          "properties": {
            "name": { "type": "string" },
            "label": { "type": "string" },
            "labelKey": { "type": "string" },
            "placeholder": { "type": "string" },
            "required": { "enum": ["true", "false"] },
            "requiredWhen": { "type": "string" },
            "requiredMessage": { "type": "string" },
            "min": { "type": "string" },
            "max": { "type": "string" },
            "minLength": { "type": "string" },
            "maxLength": { "type": "string" },
            "pattern": { "type": "string" },
            "patternMessage": { "type": "string" }
          }
        }
      ]
    },
    "tableAttributes": {
      "allOf": [
        {
          "$ref": "#/$defs/commonAttributes"
        },
        {
          "type": "object",
          "properties": {
            "source": { "type": "string" },
            "pagination": { "enum": ["true", "false"] },
            "serverSide": { "enum": ["true", "false"] },
            "selectable": { "enum": ["true", "false"] },
            "pageSize": { "type": "string" },
            "pageSizeOptions": { "type": "string", "description": "Comma-separated sizes, for example 10,25,50." }
          }
        }
      ]
    },
    "columnAttributes": {
      "type": "object",
      "properties": {
        "field": { "type": "string" },
        "label": { "type": "string" },
        "labelKey": { "type": "string" },
        "filter": { "enum": ["true", "false"] },
        "sortable": { "enum": ["true", "false"] },
        "renderer": { "type": "string" }
      }
    }
  }
}
