{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "reversa-pricing-size-v1.1",
  "title": "Reversa Pricing Size",
  "description": "Métricas estruturais e score de tamanho de uma feature, gerado pelo agente reversa-pricing-size e consumido pelo agente reversa-pricing-estimate.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "formula_version",
    "created_at",
    "feature_dir",
    "metrics",
    "sizing_method",
    "base_complexity_class",
    "risk_points",
    "risk_adjustment_classes",
    "size_score",
    "complexity_class"
  ],
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "1.1"
    },
    "formula_version": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+$"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "feature_dir": {
      "type": "string",
      "minLength": 1
    },
    "metrics": {
      "type": "object",
      "additionalProperties": false,
      "required": ["requirements", "doubts", "tasks", "plan_depth", "principles_touched"],
      "properties": {
        "requirements": {
          "type": "object",
          "additionalProperties": false,
          "required": ["total"],
          "properties": {
            "total": { "type": "integer", "minimum": 0 },
            "functional": { "type": "integer", "minimum": 0 },
            "non_functional": { "type": "integer", "minimum": 0 },
            "constraint": { "type": "integer", "minimum": 0 }
          }
        },
        "doubts": {
          "type": "object",
          "additionalProperties": false,
          "required": ["total"],
          "properties": {
            "total": { "type": "integer", "minimum": 0 },
            "high": { "type": "integer", "minimum": 0 },
            "medium": { "type": "integer", "minimum": 0 },
            "low": { "type": "integer", "minimum": 0 }
          }
        },
        "tasks": {
          "type": "object",
          "additionalProperties": false,
          "required": ["total"],
          "properties": {
            "total": { "type": "integer", "minimum": 0 },
            "new": { "type": "integer", "minimum": 0 },
            "modify": { "type": "integer", "minimum": 0 },
            "delete": { "type": "integer", "minimum": 0 },
            "test": { "type": "integer", "minimum": 0 },
            "infra": { "type": "integer", "minimum": 0 }
          }
        },
        "plan_depth": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10
        },
        "principles_touched": {
          "type": "array",
          "items": { "type": "string", "minLength": 1 },
          "uniqueItems": true
        }
      }
    },
    "sizing_method": {
      "type": "string",
      "const": "task_tshirt_with_risk_adjustment"
    },
    "base_complexity_class": {
      "type": "string",
      "enum": ["S", "M", "L", "XL", "XXL"]
    },
    "risk_points": {
      "type": "integer",
      "minimum": 0
    },
    "risk_adjustment_classes": {
      "type": "integer",
      "minimum": 0,
      "maximum": 2
    },
    "size_score": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100
    },
    "complexity_class": {
      "type": "string",
      "enum": ["S", "M", "L", "XL", "XXL"]
    },
    "notes": {
      "type": "string"
    }
  }
}
