{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/anomalyarmor-ai/json-schema/anomalyarmor-ai-create-custom-sql-monitor-request-schema.json",
  "title": "CreateCustomSqlMonitorRequest",
  "description": "Request to create a custom SQL monitor.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/anomalyarmor-ai-custom-sql-api-openapi.yml#/components/schemas/CreateCustomSqlMonitorRequest",
  "properties": {
    "name": {
      "type": "string",
      "maxLength": 255,
      "minLength": 1,
      "title": "Name",
      "description": "Human-readable name for this monitor"
    },
    "description": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 1000
        },
        {
          "type": "null"
        }
      ],
      "title": "Description",
      "description": "Optional description of what this monitor checks"
    },
    "sql_query": {
      "type": "string",
      "minLength": 1,
      "title": "Sql Query",
      "description": "SELECT query that returns a single numeric value"
    },
    "table_path": {
      "type": "string",
      "maxLength": 500,
      "minLength": 1,
      "title": "Table Path",
      "description": "Primary table being monitored (for asset association)"
    },
    "upper_bound": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Upper Bound",
      "description": "Alert if value exceeds this threshold"
    },
    "lower_bound": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Lower Bound",
      "description": "Alert if value drops below this threshold"
    },
    "check_interval": {
      "type": "string",
      "pattern": "^(hourly|daily|weekly|monthly|\\d+[mhd]|@[a-z_]+|\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+)$",
      "title": "Check Interval",
      "description": "How often to run (hourly, daily, weekly, or cron expression)"
    },
    "timeout_seconds": {
      "type": "integer",
      "maximum": 300.0,
      "minimum": 1.0,
      "title": "Timeout Seconds",
      "description": "Query execution timeout in seconds",
      "default": 60
    },
    "enabled": {
      "type": "boolean",
      "title": "Enabled",
      "description": "Whether the monitor should be active immediately",
      "default": true
    }
  },
  "type": "object",
  "required": [
    "name",
    "sql_query",
    "table_path",
    "check_interval"
  ]
}