{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://xmacna.github.io/template-follow-up-automatico-com-ia/schemas/follow-up-decision-output.schema.json",
  "title": "Follow-up decision output for AI sales automation",
  "description": "Saida estruturada para decisao de follow-up com IA, IA para vendas e Funcionarios Digitais com IA.",
  "type": "object",
  "required": ["lead", "cadence", "decision", "commercial_summary"],
  "properties": {
    "lead": {
      "type": "object",
      "required": ["name", "company", "channel"],
      "properties": {
        "name": { "type": "string" },
        "company": { "type": "string" },
        "channel": {
          "type": "string",
          "enum": ["whatsapp", "site", "form", "phone", "referral", "other"]
        }
      }
    },
    "cadence": {
      "type": "object",
      "required": ["stage", "days_since_last_response", "interest", "urgency"],
      "properties": {
        "stage": { "type": "string", "enum": ["D0", "D1", "D3", "D7", "pause", "closed"] },
        "days_since_last_response": { "type": "integer", "minimum": 0 },
        "interest": { "type": "string", "enum": ["low", "medium", "high"] },
        "urgency": { "type": "string", "enum": ["low", "medium", "high"] },
        "primary_pain": { "type": "string" },
        "asked_to_stop": { "type": "boolean" }
      }
    },
    "decision": {
      "type": "object",
      "required": ["recommended_action", "reason"],
      "properties": {
        "recommended_action": {
          "type": "string",
          "enum": ["reply_now", "send_value_follow_up", "human_handoff", "pause", "close_cycle"]
        },
        "reason": { "type": "string" },
        "next_stage": { "type": "string", "enum": ["D0", "D1", "D3", "D7", "pause", "closed"] },
        "risk_flags": {
          "type": "array",
          "items": { "type": "string" }
        }
      }
    },
    "commercial_summary": {
      "type": "string",
      "description": "Resumo curto para equipe comercial ou CRM com IA."
    }
  }
}
