{
  "type": "object",
  "properties": {
    "spec": {
      "type": "object",
      "required": [
        "query"
      ],
      "properties": {
        "query": {
          "type": "string",
          "description": "Natural language question about system health",
          "minLength": 1,
          "maxLength": 5000
        },
        "timeout": {
          "type": "integer",
          "description": "Execution timeout in seconds",
          "default": 30,
          "minimum": 1,
          "maximum": 300
        },
        "mode": {
          "type": "string",
          "description": "Execution mode: 'alert' sends notifications on failure, 'monitor' logs only",
          "default": "monitor",
          "enum": [
            "alert",
            "monitor"
          ]
        },
        "model": {
          "type": "string",
          "description": "Override default LLM model for this check"
        },
        "destinations": {
          "type": "array",
          "description": "Alert destinations for failed checks (only used in alert mode)",
          "items": {
            "type": "object",
            "required": [
              "type"
            ],
            "properties": {
              "type": {
                "type": "string",
                "description": "Destination type (e.g., 'slack', 'pagerduty')"
              },
              "config": {
                "type": "object",
                "description": "Destination-specific configuration",
                "x-kubernetes-preserve-unknown-fields": true
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    },
    "status": {
      "type": "object",
      "properties": {
        "phase": {
          "type": "string",
          "description": "Execution phase: Pending, Running, Completed, Failed",
          "enum": [
            "Pending",
            "Running",
            "Completed",
            "Failed"
          ]
        },
        "startTime": {
          "type": "string",
          "format": "date-time",
          "description": "When the check execution started"
        },
        "completionTime": {
          "type": "string",
          "format": "date-time",
          "description": "When the check execution completed"
        },
        "result": {
          "type": "string",
          "description": "Check result: pass, fail, or error",
          "enum": [
            "pass",
            "fail",
            "error"
          ]
        },
        "message": {
          "type": "string",
          "description": "Human-readable summary of the result"
        },
        "rationale": {
          "type": "string",
          "description": "Detailed explanation from the LLM about the decision"
        },
        "duration": {
          "type": "number",
          "description": "Execution duration in seconds"
        },
        "error": {
          "type": "string",
          "description": "Error details if execution failed"
        },
        "modelUsed": {
          "type": "string",
          "description": "The actual LLM model used for execution"
        },
        "conditions": {
          "type": "array",
          "description": "Standard Kubernetes conditions",
          "items": {
            "type": "object",
            "required": [
              "type",
              "status"
            ],
            "properties": {
              "type": {
                "type": "string",
                "description": "Condition type (e.g., 'Complete', 'Failed')"
              },
              "status": {
                "type": "string",
                "description": "Condition status: True, False, or Unknown",
                "enum": [
                  "True",
                  "False",
                  "Unknown"
                ]
              },
              "lastTransitionTime": {
                "type": "string",
                "format": "date-time",
                "description": "Last time the condition transitioned"
              },
              "reason": {
                "type": "string",
                "description": "Machine-readable reason for the condition"
              },
              "message": {
                "type": "string",
                "description": "Human-readable message about the condition"
              }
            },
            "additionalProperties": false
          }
        },
        "notifications": {
          "type": "array",
          "description": "Status of notification delivery attempts",
          "items": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "description": "Notification type (e.g., 'slack', 'pagerduty')"
              },
              "channel": {
                "type": "string",
                "description": "Target channel or destination"
              },
              "status": {
                "type": "string",
                "description": "Delivery status: sent, failed, skipped",
                "enum": [
                  "sent",
                  "failed",
                  "skipped"
                ]
              },
              "error": {
                "type": "string",
                "description": "Error message if delivery failed"
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    }
  }
}
