[
  {
    "version": "1.0",
    "createSurface": {
      "surfaceId": "vendas-q4-01",
      "catalogId": "https://uinova.walderpinheiro.com.br/a2ui/catalog/v1.json",
      "sendDataModel": false,
      "components": [
        {
          "id": "root",
          "component": "Column",
          "gap": "6",
          "children": ["cabecalho", "kpis", "linha_detalhes", "tabela_sec"]
        },
        {
          "id": "cabecalho",
          "component": "Row",
          "justify": "spaceBetween",
          "children": ["titulo", "filtros"]
        },
        {
          "id": "filtros",
          "component": "Row",
          "gap": "2",
          "children": ["periodo", "atualizar"]
        },
        { "id": "titulo", "component": "Text", "variant": "h2", "text": "Vendas — 4º trimestre" },
        {
          "id": "periodo",
          "component": "SegmentedControl",
          "options": [
            { "value": "30d", "label": "30 dias" },
            { "value": "90d", "label": "90 dias" },
            { "value": "ytd", "label": "Ano" }
          ],
          "value": { "@path": "/filtro/periodo" },
          "@accessibility": { "label": "Período" }
        },
        {
          "id": "atualizar",
          "component": "Button",
          "variant": "icon",
          "child": "atualizar_icone",
          "@accessibility": { "label": "Atualizar com o período escolhido" },
          "action": {
            "event": { "name": "dashboard.trocarPeriodo", "context": { "periodo": { "@path": "/filtro/periodo" } } }
          }
        },
        { "id": "atualizar_icone", "component": "Icon", "icon": "redo" },
        {
          "id": "kpis",
          "component": "CardGrid",
          "cols": { "default": 1, "sm": 2, "lg": 4 },
          "children": ["kpi_receita", "kpi_pedidos", "kpi_ticket", "kpi_churn"]
        },
        {
          "id": "kpi_receita",
          "component": "StatCard",
          "label": "Receita",
          "icon": "dollar-sign",
          "value": { "@call": "formatCurrency", "args": { "value": { "@path": "/kpis/receita" }, "currency": "BRL" } },
          "delta": "+12,4%",
          "trend": "up",
          "deltaCaption": "vs. trimestre anterior"
        },
        {
          "id": "kpi_pedidos",
          "component": "StatCard",
          "label": "Pedidos",
          "icon": "receipt",
          "value": { "@call": "formatNumber", "args": { "value": { "@path": "/kpis/pedidos" } } },
          "delta": "+3,1%",
          "trend": "up"
        },
        {
          "id": "kpi_ticket",
          "component": "StatCard",
          "label": "Ticket médio",
          "icon": "wallet",
          "value": { "@call": "formatCurrency", "args": { "value": { "@path": "/kpis/ticket" }, "currency": "BRL" } },
          "delta": "-1,8%",
          "trend": "down"
        },
        {
          "id": "kpi_churn",
          "component": "StatCard",
          "label": "Churn",
          "icon": "trending",
          "value": { "@path": "/kpis/churnTexto" },
          "trend": "neutral",
          "caption": "Média mensal"
        },
        {
          "id": "linha_detalhes",
          "component": "Row",
          "gap": "6",
          "align": "stretch",
          "children": ["card_canais", "card_resumo"]
        },
        {
          "id": "card_canais",
          "component": "Card",
          "title": "Receita por canal",
          "variant": "outlined",
          "weight": 2,
          "child": "barras_canais"
        },
        {
          "id": "barras_canais",
          "component": "BarList",
          "unit": "%",
          "emphasis": "max",
          "items": { "@path": "/canais" }
        },
        {
          "id": "card_resumo",
          "component": "Card",
          "title": "Resumo",
          "variant": "outlined",
          "weight": 1,
          "child": "resumo"
        },
        {
          "id": "resumo",
          "component": "DescriptionList",
          "layout": "inline",
          "dividers": true,
          "items": { "@path": "/resumo" }
        },
        {
          "id": "tabela_sec",
          "component": "Section",
          "title": "Maiores contas",
          "headingLevel": "3",
          "child": "tabela"
        },
        {
          "id": "tabela",
          "component": "Table",
          "variant": "striped",
          "size": "compact",
          "columns": [
            { "key": "name", "label": "Conta", "sortable": true },
            { "key": "owner", "label": "Responsável", "priority": 2 },
            { "key": "status", "label": "Status", "cell": "status" },
            { "key": "mrr", "label": "MRR", "sortable": true }
          ],
          "rows": { "@path": "/contas" },
          "pageSize": 5,
          "total": { "@path": "/contasTotal" },
          "rowAction": {
            "event": { "name": "dashboard.abrirConta", "context": { "origem": "tabela-maiores-contas" } }
          }
        }
      ],
      "dataModel": {
        "filtro": { "periodo": "90d" },
        "kpis": { "receita": 1843200, "pedidos": 9412, "ticket": 195.84, "churnTexto": "2,3%" },
        "canais": [
          { "label": "Inbound", "value": 41, "display": "41%" },
          { "label": "Parcerias", "value": 27, "display": "27%" },
          { "label": "Outbound", "value": 19, "display": "19%" },
          { "label": "Marketplace", "value": 13, "display": "13%" }
        ],
        "resumo": [
          { "label": "Novos clientes", "value": 312 },
          { "label": "Expansões", "value": 87 },
          { "label": "Cancelamentos", "value": 41, "hint": "Concentrados em planos mensais" }
        ],
        "contas": [
          { "id": "c-101", "name": "Atlas Logística", "owner": "R. Lima", "status": "active", "mrr": "R$ 48.900" },
          { "id": "c-102", "name": "Prisma Saúde", "owner": "J. Prado", "status": "in-review", "mrr": "R$ 41.250" },
          { "id": "c-103", "name": "Vértice Energia", "owner": "M. Reis", "status": "active", "mrr": "R$ 37.800" }
        ],
        "contasTotal": 128
      }
    }
  },
  {
    "version": "1.0",
    "updateDataModel": {
      "surfaceId": "vendas-q4-01",
      "path": "/kpis",
      "value": { "receita": 612400, "pedidos": 3120, "ticket": 196.28, "churnTexto": "2,1%" }
    }
  },
  {
    "version": "1.0",
    "updateDataModel": {
      "surfaceId": "vendas-q4-01",
      "path": "/canais/0/value",
      "value": 44
    }
  }
]
