{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://seanmcquilling.com/schemas/agent-threat-model.schema.json",
  "title": "Trace Lab Agent Threat Model",
  "type": "object",
  "additionalProperties": false,
  "required": ["version", "created", "system", "threats", "highestResidual", "frameworkMappings"],
  "properties": {
    "$schema": { "const": "https://seanmcquilling.com/schemas/agent-threat-model.schema.json" },
    "version": { "const": 1 },
    "created": { "type": "string", "format": "date-time" },
    "highestResidual": { "type": "integer", "minimum": 0, "maximum": 25 },
    "frameworkMappings": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "required": ["owasp", "nistAiRmf", "mitreAtlas"],
        "properties": {
          "owasp": { "type": "array", "items": { "type": "string" } },
          "nistAiRmf": { "type": "array", "items": { "type": "string" } },
          "mitreAtlas": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "system": {
      "type": "object",
      "required": ["name", "purpose", "deployment", "assets", "autonomy", "sensitivity", "identity", "oversight", "entries", "capabilities", "controls"],
      "properties": {
        "name": { "type": "string", "minLength": 1 }, "purpose": { "type": "string", "minLength": 1 }, "deployment": { "type": "string" },
        "assets": { "type": "array", "items": { "type": "string" } }, "autonomy": { "type": "integer", "minimum": 1, "maximum": 4 },
        "sensitivity": { "type": "integer", "minimum": 1, "maximum": 4 }, "identity": { "type": "string" }, "oversight": { "type": "string" },
        "entries": { "type": "array", "items": { "type": "string" } }, "capabilities": { "type": "array", "items": { "type": "string" } },
        "controls": { "type": "array", "items": { "type": "string" } }
      }
    },
    "threats": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "title", "category", "description", "entry", "effect", "likelihood", "impact", "inherent", "residual", "severity", "controls", "missing"],
        "properties": {
          "id": { "type": "string" }, "title": { "type": "string" }, "category": { "type": "string" }, "description": { "type": "string" },
          "entry": { "type": "string" }, "effect": { "type": "string" }, "likelihood": { "type": "integer", "minimum": 1, "maximum": 5 },
          "impact": { "type": "integer", "minimum": 1, "maximum": 5 }, "inherent": { "type": "integer", "minimum": 1, "maximum": 25 },
          "residual": { "type": "integer", "minimum": 1, "maximum": 25 }, "severity": { "enum": ["critical", "high", "medium", "low"] },
          "controls": { "type": "array", "items": { "type": "string" } }, "missing": { "type": "array", "items": { "type": "string" } }
        }
      }
    }
  }
}
