{
  "_notes": [
    "Schema Typebot v6 — gerado manualmente a partir da spec fluxo-bot-qualificacao-patrimonial.md.",
    "Suposições de schema:",
    "1. Blocos de texto usam type 'bubbles/text' com richText Slate (children array com paragraph nodes).",
    "2. Choice input usa type 'inputs/choice' com isMultipleChoice:false e options.items como array de {id, content}.",
    "3. set-variable usa type 'logic/set-variable' com variableId e expressionToEvaluate (string JS).",
    "4. Condição usa type 'logic/condition' com comparisons array e outgoingEdgeIds indexado por resultado.",
    "5. Text input usa type 'inputs/text'; phone usa type 'inputs/phone-number' com defaultCountryCode 'BR'.",
    "6. Redirect usa type 'logic/redirect' com url (string com variáveis {{var-xxx}}).",
    "7. edges: array de {id, from:{blockId}, to:{groupId}} — edges de choice saem do bloco input (não do item).",
    "8. O campo 'start' no raiz aponta para o groupId do primeiro grupo.",
    "9. variableId nos blocos referencia o id da variável no array 'variables'.",
    "10. Score calculado via expressão JS inline no bloco set-variable do G7.",
    "11. Tier calculado via segunda expressão JS após score.",
    "12. Bloco condition do G7 usa 'logic/condition' com duas comparisons (score >= 9, score >= 5) e 3 outgoingEdgeIds.",
    "13. LGPD implementada como choice input de item único 'Concordo' — usuário deve selecionar ativamente (não pré-marcado).",
    "14. Handoff WhatsApp via logic/redirect para wa.me com querystring text=... URL-encoded com as variáveis do template.",
    "15. Placeholder [WHATSAPP_TIME_A_DEFINIR] deve ser substituído pelo número real antes de publicar.",
    "16. IDs são strings estáticas descritivas, sem timestamps."
  ],
  "version": "6",
  "name": "Qualificação Patrimonial — Pinheiro Lima",
  "isBrandingEnabled": false,
  "start": { "groupId": "grp-abertura" },
  "variables": [
    { "id": "var-objetivo",          "name": "objetivo" },
    { "id": "var-faixa-patrimonio",  "name": "faixa_patrimonio" },
    { "id": "var-composicao",        "name": "composicao" },
    { "id": "var-tem-planejamento",  "name": "tem_planejamento" },
    { "id": "var-gatilho-tempo",     "name": "gatilho_tempo" },
    { "id": "var-perfil",            "name": "perfil" },
    { "id": "var-nome",              "name": "nome" },
    { "id": "var-whatsapp",          "name": "whatsapp" },
    { "id": "var-score",             "name": "score" },
    { "id": "var-tier",              "name": "tier" }
  ],
  "groups": [
    {
      "id": "grp-abertura",
      "title": "G1 — Abertura",
      "graphCoordinates": { "x": 0, "y": 0 },
      "blocks": [
        {
          "id": "blk-abertura-msg",
          "type": "bubbles/text",
          "content": {
            "richText": [
              {
                "type": "p",
                "children": [
                  { "text": "Olá! Posso te ajudar a entender, em poucos minutos, como está a sua exposição patrimonial e o que a mudança das regras em 2026 significa para você. São 5 perguntas rápidas. Vamos?" }
                ]
              }
            ]
          }
        },
        {
          "id": "blk-abertura-choice",
          "type": "inputs/choice",
          "options": {
            "isMultipleChoice": false,
            "items": [
              { "id": "item-abertura-vamos", "content": "Vamos lá" }
            ]
          }
        }
      ]
    },
    {
      "id": "grp-objetivo",
      "title": "G2 — Objetivo",
      "graphCoordinates": { "x": 400, "y": 0 },
      "blocks": [
        {
          "id": "blk-objetivo-msg",
          "type": "bubbles/text",
          "content": {
            "richText": [
              {
                "type": "p",
                "children": [
                  { "text": "O que mais te traz aqui?" }
                ]
              }
            ]
          }
        },
        {
          "id": "blk-objetivo-choice",
          "type": "inputs/choice",
          "variableId": "var-objetivo",
          "options": {
            "isMultipleChoice": false,
            "items": [
              { "id": "item-obj-sucessao",  "content": "Planejar a sucessão / herança" },
              { "id": "item-obj-blindagem", "content": "Proteger o patrimônio (blindagem)" },
              { "id": "item-obj-holding",   "content": "Avaliar uma holding" },
              { "id": "item-obj-organizar", "content": "Organizar imóveis/empresa" },
              { "id": "item-obj-informando","content": "Só me informando" }
            ]
          }
        }
      ]
    },
    {
      "id": "grp-faixa-patrimonio",
      "title": "G3 — Faixa de Patrimônio",
      "graphCoordinates": { "x": 800, "y": 0 },
      "blocks": [
        {
          "id": "blk-faixa-msg",
          "type": "bubbles/text",
          "content": {
            "richText": [
              {
                "type": "p",
                "children": [
                  { "text": "Para calibrar a orientação, em que faixa está o patrimônio que você pensa em organizar?" }
                ]
              }
            ]
          }
        },
        {
          "id": "blk-faixa-choice",
          "type": "inputs/choice",
          "variableId": "var-faixa-patrimonio",
          "options": {
            "isMultipleChoice": false,
            "items": [
              { "id": "item-faixa-ate1mi",    "content": "Até R$ 1 mi" },
              { "id": "item-faixa-1a5mi",     "content": "R$ 1 mi a R$ 5 mi" },
              { "id": "item-faixa-5a20mi",    "content": "R$ 5 mi a R$ 20 mi" },
              { "id": "item-faixa-acima20mi", "content": "Acima de R$ 20 mi" }
            ]
          }
        }
      ]
    },
    {
      "id": "grp-composicao",
      "title": "G4 — Composição",
      "graphCoordinates": { "x": 1200, "y": 0 },
      "blocks": [
        {
          "id": "blk-composicao-msg",
          "type": "bubbles/text",
          "content": {
            "richText": [
              {
                "type": "p",
                "children": [
                  { "text": "A maior parte está em quê?" }
                ]
              }
            ]
          }
        },
        {
          "id": "blk-composicao-choice",
          "type": "inputs/choice",
          "variableId": "var-composicao",
          "options": {
            "isMultipleChoice": false,
            "items": [
              { "id": "item-comp-imoveis",     "content": "Imóveis" },
              { "id": "item-comp-empresa",     "content": "Empresa / participação societária" },
              { "id": "item-comp-financeiras", "content": "Aplicações financeiras" },
              { "id": "item-comp-misto",       "content": "Misto" }
            ]
          }
        }
      ]
    },
    {
      "id": "grp-planejamento",
      "title": "G5 — Planejamento Atual",
      "graphCoordinates": { "x": 1600, "y": 0 },
      "blocks": [
        {
          "id": "blk-planejamento-msg",
          "type": "bubbles/text",
          "content": {
            "richText": [
              {
                "type": "p",
                "children": [
                  { "text": "Você já tem algum planejamento estruturado (holding, testamento, doação em vida)?" }
                ]
              }
            ]
          }
        },
        {
          "id": "blk-planejamento-choice",
          "type": "inputs/choice",
          "variableId": "var-tem-planejamento",
          "options": {
            "isMultipleChoice": false,
            "items": [
              { "id": "item-plan-nada",       "content": "Não tenho nada" },
              { "id": "item-plan-antigo",     "content": "Tenho, mas antigo" },
              { "id": "item-plan-atualizado", "content": "Tenho e está atualizado" }
            ]
          }
        }
      ]
    },
    {
      "id": "grp-gatilho",
      "title": "G6 — Gatilho de Tempo",
      "graphCoordinates": { "x": 2000, "y": 0 },
      "blocks": [
        {
          "id": "blk-gatilho-msg",
          "type": "bubbles/text",
          "content": {
            "richText": [
              {
                "type": "p",
                "children": [
                  { "text": "Existe algo no horizonte? (venda de empresa, mudança na família, planejamento de aposentadoria...)" }
                ]
              }
            ]
          }
        },
        {
          "id": "blk-gatilho-choice",
          "type": "inputs/choice",
          "variableId": "var-gatilho-tempo",
          "options": {
            "isMultipleChoice": false,
            "items": [
              { "id": "item-gat-proximos",    "content": "Sim, algo nos próximos meses" },
              { "id": "item-gat-preventivo",  "content": "Nada urgente, é preventivo" },
              { "id": "item-gat-nao-dizer",   "content": "Prefiro não dizer agora" }
            ]
          }
        }
      ]
    },
    {
      "id": "grp-score",
      "title": "G7 — Cálculo de Score",
      "graphCoordinates": { "x": 2400, "y": 0 },
      "blocks": [
        {
          "id": "blk-set-score",
          "type": "logic/set-variable",
          "options": {
            "variableId": "var-score",
            "expressionToEvaluate": "(function(){\n  var s = 0;\n  // faixa_patrimonio\n  var fp = {{var-faixa-patrimonio}};\n  if(fp === 'Acima de R$ 20 mi') s += 4;\n  else if(fp === 'R$ 5 mi a R$ 20 mi') s += 3;\n  else if(fp === 'R$ 1 mi a R$ 5 mi') s += 2;\n  else if(fp === 'Até R$ 1 mi') s += 1;\n  // composicao\n  var comp = {{var-composicao}};\n  if(comp === 'Imóveis' || comp === 'Empresa / participação societária' || comp === 'Misto') s += 2;\n  else if(comp === 'Aplicações financeiras') s += 1;\n  // tem_planejamento\n  var tp = {{var-tem-planejamento}};\n  if(tp === 'Tenho, mas antigo') s += 3;\n  else if(tp === 'Não tenho nada') s += 2;\n  else if(tp === 'Tenho e está atualizado') s += 1;\n  // objetivo\n  var obj = {{var-objetivo}};\n  if(obj === 'Planejar a sucessão / herança' || obj === 'Proteger o patrimônio (blindagem)' || obj === 'Avaliar uma holding') s += 2;\n  else if(obj === 'Organizar imóveis/empresa') s += 1;\n  // gatilho_tempo\n  var gt = {{var-gatilho-tempo}};\n  if(gt === 'Sim, algo nos próximos meses') s += 2;\n  else if(gt === 'Nada urgente, é preventivo') s += 1;\n  return s;\n})()"
          }
        },
        {
          "id": "blk-set-tier",
          "type": "logic/set-variable",
          "options": {
            "variableId": "var-tier",
            "expressionToEvaluate": "(function(){\n  var sc = Number({{var-score}});\n  if(sc >= 9) return 'quente';\n  if(sc >= 5) return 'morno';\n  return 'frio';\n})()"
          }
        },
        {
          "id": "blk-condition-tier",
          "type": "logic/condition",
          "options": {
            "logicalOperator": "OR",
            "conditions": [
              {
                "id": "cond-quente",
                "variableId": "var-score",
                "comparisonOperator": ">=",
                "value": "9"
              },
              {
                "id": "cond-morno",
                "variableId": "var-score",
                "comparisonOperator": ">=",
                "value": "5"
              }
            ]
          },
          "outgoingEdgeIds": {
            "condTrue0": "edge-score-to-quente",
            "condTrue1": "edge-score-to-morno",
            "condFalse": "edge-score-to-frio"
          }
        }
      ]
    },
    {
      "id": "grp-quente",
      "title": "G8A — Tier Quente",
      "graphCoordinates": { "x": 2800, "y": -300 },
      "blocks": [
        {
          "id": "blk-quente-msg1",
          "type": "bubbles/text",
          "content": {
            "richText": [
              {
                "type": "p",
                "children": [
                  { "text": "Pelo porte e pela composição do que você descreveu, faz muito sentido um diagnóstico individual — principalmente com as regras que mudaram em 2026. Posso agendar uma conversa com a equipe?" }
                ]
              }
            ]
          }
        },
        {
          "id": "blk-quente-lgpd-msg",
          "type": "bubbles/text",
          "content": {
            "richText": [
              {
                "type": "p",
                "children": [
                  { "text": "Para continuar, preciso do seu consentimento para tratar seus dados conforme a LGPD. Seus dados serão usados exclusivamente para contato sobre planejamento patrimonial. " },
                  { "text": "Política de Privacidade: https://pinheirolimaadvocacia.com.br/privacidade", "italic": true }
                ]
              }
            ]
          }
        },
        {
          "id": "blk-quente-lgpd-choice",
          "type": "inputs/choice",
          "options": {
            "isMultipleChoice": false,
            "items": [
              { "id": "item-quente-lgpd-ok", "content": "Concordo" }
            ]
          }
        },
        {
          "id": "blk-quente-nome-msg",
          "type": "bubbles/text",
          "content": {
            "richText": [
              { "type": "p", "children": [{ "text": "Qual é o seu nome?" }] }
            ]
          }
        },
        {
          "id": "blk-quente-nome-input",
          "type": "inputs/text",
          "variableId": "var-nome",
          "options": {
            "placeholder": "Seu nome"
          }
        },
        {
          "id": "blk-quente-whatsapp-msg",
          "type": "bubbles/text",
          "content": {
            "richText": [
              { "type": "p", "children": [{ "text": "E o seu WhatsApp com DDD?" }] }
            ]
          }
        },
        {
          "id": "blk-quente-whatsapp-input",
          "type": "inputs/phone-number",
          "variableId": "var-whatsapp",
          "options": {
            "defaultCountryCode": "BR",
            "placeholder": "(11) 99999-9999"
          }
        },
        {
          "id": "blk-quente-encerramento-msg",
          "type": "bubbles/text",
          "content": {
            "richText": [
              {
                "type": "p",
                "children": [
                  { "text": "Perfeito, {{var-nome}}! Nossa equipe vai entrar em contato em breve para agendar seu diagnóstico individual. Até logo!" }
                ]
              }
            ]
          }
        },
        {
          "id": "blk-quente-redirect",
          "type": "logic/redirect",
          "options": {
            "url": "https://wa.me/[WHATSAPP_TIME_A_DEFINIR]?text=%F0%9F%9F%A2+Lead+patrimonial+%E2%80%94+TIER%3A+{{var-tier}}+%28score+{{var-score}}%29%0AObjetivo%3A+{{var-objetivo}}%0APatrim%C3%B4nio%3A+{{var-faixa-patrimonio}}+%C2%B7+Composi%C3%A7%C3%A3o%3A+{{var-composicao}}%0APlanejamento+atual%3A+{{var-tem-planejamento}}%0AGatilho%3A+{{var-gatilho-tempo}}%0AContato%3A+{{var-nome}}+%E2%80%94+{{var-whatsapp}}",
            "isNewTab": true
          }
        }
      ]
    },
    {
      "id": "grp-morno",
      "title": "G8B — Tier Morno",
      "graphCoordinates": { "x": 2800, "y": 0 },
      "blocks": [
        {
          "id": "blk-morno-msg1",
          "type": "bubbles/text",
          "content": {
            "richText": [
              {
                "type": "p",
                "children": [
                  { "text": "Dá para te enviar um material que explica o que mudou em 2026 e, se fizer sentido, marcar uma conversa. Pode ser?" }
                ]
              }
            ]
          }
        },
        {
          "id": "blk-morno-lgpd-msg",
          "type": "bubbles/text",
          "content": {
            "richText": [
              {
                "type": "p",
                "children": [
                  { "text": "Para continuar, preciso do seu consentimento para tratar seus dados conforme a LGPD. Seus dados serão usados exclusivamente para contato sobre planejamento patrimonial. " },
                  { "text": "Política de Privacidade: https://pinheirolimaadvocacia.com.br/privacidade", "italic": true }
                ]
              }
            ]
          }
        },
        {
          "id": "blk-morno-lgpd-choice",
          "type": "inputs/choice",
          "options": {
            "isMultipleChoice": false,
            "items": [
              { "id": "item-morno-lgpd-ok", "content": "Concordo" }
            ]
          }
        },
        {
          "id": "blk-morno-nome-msg",
          "type": "bubbles/text",
          "content": {
            "richText": [
              { "type": "p", "children": [{ "text": "Qual é o seu nome?" }] }
            ]
          }
        },
        {
          "id": "blk-morno-nome-input",
          "type": "inputs/text",
          "variableId": "var-nome",
          "options": {
            "placeholder": "Seu nome"
          }
        },
        {
          "id": "blk-morno-whatsapp-msg",
          "type": "bubbles/text",
          "content": {
            "richText": [
              { "type": "p", "children": [{ "text": "E o seu WhatsApp com DDD?" }] }
            ]
          }
        },
        {
          "id": "blk-morno-whatsapp-input",
          "type": "inputs/phone-number",
          "variableId": "var-whatsapp",
          "options": {
            "defaultCountryCode": "BR",
            "placeholder": "(11) 99999-9999"
          }
        },
        {
          "id": "blk-morno-encerramento-msg",
          "type": "bubbles/text",
          "content": {
            "richText": [
              {
                "type": "p",
                "children": [
                  { "text": "Ótimo, {{var-nome}}! Vamos te enviar o material sobre as mudanças de 2026. Quando quiser avançar para uma conversa, é só nos chamar!" }
                ]
              }
            ]
          }
        },
        {
          "id": "blk-morno-redirect",
          "type": "logic/redirect",
          "options": {
            "url": "https://wa.me/[WHATSAPP_TIME_A_DEFINIR]?text=%F0%9F%9F%A1+Lead+patrimonial+%E2%80%94+TIER%3A+{{var-tier}}+%28score+{{var-score}}%29%0AObjetivo%3A+{{var-objetivo}}%0APatrim%C3%B4nio%3A+{{var-faixa-patrimonio}}+%C2%B7+Composi%C3%A7%C3%A3o%3A+{{var-composicao}}%0APlanejamento+atual%3A+{{var-tem-planejamento}}%0AGatilho%3A+{{var-gatilho-tempo}}%0AContato%3A+{{var-nome}}+%E2%80%94+{{var-whatsapp}}",
            "isNewTab": true
          }
        }
      ]
    },
    {
      "id": "grp-frio",
      "title": "G8C — Tier Frio",
      "graphCoordinates": { "x": 2800, "y": 300 },
      "blocks": [
        {
          "id": "blk-frio-msg1",
          "type": "bubbles/text",
          "content": {
            "richText": [
              {
                "type": "p",
                "children": [
                  { "text": "Posso te mandar conteúdos sobre planejamento patrimonial para você se aprofundar no seu tempo. Quando quiser olhar o seu caso, é só voltar aqui." }
                ]
              }
            ]
          }
        },
        {
          "id": "blk-frio-msg2",
          "type": "bubbles/text",
          "content": {
            "richText": [
              {
                "type": "p",
                "children": [
                  { "text": "Enquanto isso, confira nossos conteúdos educativos:" }
                ]
              },
              {
                "type": "p",
                "children": [
                  { "text": "📚 O que muda no ITCMD em 2026: https://pinheirolimaadvocacia.com.br/itcmd-2026" }
                ]
              },
              {
                "type": "p",
                "children": [
                  { "text": "📚 Holding familiar: quando vale a pena? https://pinheirolimaadvocacia.com.br/holding" }
                ]
              }
            ]
          }
        },
        {
          "id": "blk-frio-encerramento-msg",
          "type": "bubbles/text",
          "content": {
            "richText": [
              {
                "type": "p",
                "children": [
                  { "text": "Qualquer dúvida ou quando quiser uma avaliação do seu caso, estamos aqui. Até logo!" }
                ]
              }
            ]
          }
        }
      ]
    }
  ],
  "edges": [
    {
      "id": "edge-abertura-to-objetivo",
      "from": { "blockId": "blk-abertura-choice" },
      "to":   { "groupId": "grp-objetivo" }
    },
    {
      "id": "edge-objetivo-to-faixa",
      "from": { "blockId": "blk-objetivo-choice" },
      "to":   { "groupId": "grp-faixa-patrimonio" }
    },
    {
      "id": "edge-faixa-to-composicao",
      "from": { "blockId": "blk-faixa-choice" },
      "to":   { "groupId": "grp-composicao" }
    },
    {
      "id": "edge-composicao-to-planejamento",
      "from": { "blockId": "blk-composicao-choice" },
      "to":   { "groupId": "grp-planejamento" }
    },
    {
      "id": "edge-planejamento-to-gatilho",
      "from": { "blockId": "blk-planejamento-choice" },
      "to":   { "groupId": "grp-gatilho" }
    },
    {
      "id": "edge-gatilho-to-score",
      "from": { "blockId": "blk-gatilho-choice" },
      "to":   { "groupId": "grp-score" }
    },
    {
      "id": "edge-score-to-quente",
      "from": { "blockId": "blk-condition-tier", "conditionCase": "condTrue0" },
      "to":   { "groupId": "grp-quente" }
    },
    {
      "id": "edge-score-to-morno",
      "from": { "blockId": "blk-condition-tier", "conditionCase": "condTrue1" },
      "to":   { "groupId": "grp-morno" }
    },
    {
      "id": "edge-score-to-frio",
      "from": { "blockId": "blk-condition-tier", "conditionCase": "condFalse" },
      "to":   { "groupId": "grp-frio" }
    }
  ],
  "theme": {
    "chat": {
      "hostAvatar": { "isEnabled": true },
      "guestAvatar": { "isEnabled": false },
      "hostBubbles": {
        "backgroundColor": "#1a3a5c",
        "color": "#ffffff"
      },
      "guestBubbles": {
        "backgroundColor": "#f0f4f8",
        "color": "#1a3a5c"
      },
      "buttons": {
        "backgroundColor": "#c8a84b",
        "color": "#ffffff"
      }
    },
    "general": {
      "font": "Inter",
      "background": { "type": "Color", "content": "#ffffff" }
    }
  },
  "settings": {
    "typingEmulation": {
      "enabled": true,
      "speed": 300,
      "maxDelay": 1500
    },
    "isSaving": true,
    "isNewResultOnRefresh": false,
    "metadata": {
      "title": "Qualificação Patrimonial — Pinheiro Lima",
      "description": "Bot de qualificação para planejamento patrimonial e sucessório."
    }
  }
}
