{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://senscheck.dev/schema/effect.schema.json",
  "title": "SensCheck canonical effect v1.0",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "effectId", "principal", "action", "parameters", "risk", "proposedAt", "metadata"],
  "properties": {
    "schemaVersion": { "const": "1.0" },
    "effectId": { "type": "string", "pattern": "^[A-Za-z0-9_.:-]{1,128}$" },
    "principal": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "type"],
      "properties": {
        "id": { "type": "string", "minLength": 1, "maxLength": 256 },
        "type": { "enum": ["agent", "service", "human", "system"] }
      }
    },
    "action": {
      "type": "object",
      "additionalProperties": false,
      "required": ["verb", "resource"],
      "properties": {
        "verb": { "type": "string", "pattern": "^[A-Z][A-Z0-9_]{0,63}$" },
        "resource": { "type": "string", "minLength": 1, "maxLength": 1024 }
      }
    },
    "parameters": { "type": "object" },
    "risk": { "enum": ["LOW", "MEDIUM", "HIGH", "CRITICAL"] },
    "proposedAt": { "type": "string", "format": "date-time" },
    "metadata": { "type": "object" }
  }
}
