{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Quality Gate Plugin Schema",
  "description": "Schema for custom quality gate plugins in Loki Mode",
  "type": "object",
  "required": ["type", "name", "description", "command"],
  "properties": {
    "type": {
      "const": "quality_gate"
    },
    "name": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9-]{2,49}$",
      "description": "Unique gate name (lowercase, 3-50 chars, alphanumeric and hyphens)"
    },
    "description": {
      "type": "string",
      "maxLength": 500,
      "description": "Human-readable description of the quality gate"
    },
    "phase": {
      "type": "string",
      "enum": ["pre-commit", "post-commit", "pre-deploy", "post-deploy", "review"],
      "default": "pre-commit",
      "description": "SDLC phase when this gate runs"
    },
    "command": {
      "type": "string",
      "maxLength": 1000,
      "description": "Command to execute (exit 0 = pass, non-zero = fail)"
    },
    "timeout_ms": {
      "type": "integer",
      "minimum": 1000,
      "maximum": 300000,
      "default": 30000,
      "description": "Maximum execution time in milliseconds"
    },
    "blocking": {
      "type": "boolean",
      "default": true,
      "description": "Whether failure blocks the pipeline"
    },
    "severity": {
      "type": "string",
      "enum": ["critical", "high", "medium", "low"],
      "default": "high",
      "description": "Severity level of gate failure"
    }
  },
  "additionalProperties": false
}
