{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://interchange.stellarview.net/schemas/ai_result.schema.json",
  "title": "StellarView's answer to an ai_request. Suggestions only: each waits for a person.",
  "type": "object",
  "required": [
    "request_id",
    "by",
    "model_route",
    "answered_at",
    "results"
  ],
  "additionalProperties": false,
  "properties": {
    "request_id": {
      "type": "string",
      "format": "uuid"
    },
    "by": {
      "type": "string",
      "description": "The StellarView component that answered."
    },
    "model_route": {
      "const": "claude-code",
      "description": "Only Claude Code; no API keys."
    },
    "answered_at": {
      "type": "string",
      "format": "date-time"
    },
    "results": {
      "type": "object",
      "additionalProperties": false,
      "minProperties": 1,
      "properties": {
        "summarise": {
          "type": "object",
          "required": [
            "summary",
            "cites"
          ],
          "additionalProperties": false,
          "properties": {
            "summary": {
              "type": "string",
              "minLength": 1
            },
            "cites": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "suggest_asset": {
          "type": "object",
          "required": [
            "asset_id",
            "why",
            "confidence"
          ],
          "additionalProperties": false,
          "properties": {
            "asset_id": {
              "type": [
                "string",
                "null"
              ]
            },
            "why": {
              "type": "string"
            },
            "confidence": {
              "enum": [
                "high",
                "medium",
                "low",
                "cannot_tell"
              ]
            }
          }
        },
        "suggest_work_order": {
          "type": "object",
          "required": [
            "action",
            "why"
          ],
          "additionalProperties": false,
          "properties": {
            "action": {
              "enum": [
                "close",
                "follow_up",
                "new_work_order",
                "none",
                "cannot_tell"
              ]
            },
            "task": {
              "type": "string"
            },
            "priority": {
              "enum": [
                "low",
                "medium",
                "high",
                "highest"
              ]
            },
            "why": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
