/*
|--------------------------------------------------------------------------
| Agência PSI
|--------------------------------------------------------------------------
| Criado e desenvolvido por Leonardo Nohama
|
| Tecnologia aplicada à escuta.
| Estrutura para o cuidado.
|
| Arquivo: src/router/routes.therapist.js
| Data: 2026
| Local: São Carlos/SP — Brasil
|--------------------------------------------------------------------------
| © 2026 — Todos os direitos reservados
|--------------------------------------------------------------------------
*/
import RouterPassthrough from '@/layout/RouterPassthrough.vue';

// ── Rotas fullscreen — ficam fora do AppLayout compartilhado ──────────────
export const therapistStandalone = [
    {
        path: '/therapist/setup',
        name: 'therapist.setup',
        component: () => import('@/features/setup/SetupWizardPage.vue'),
        meta: { area: 'therapist', requiresAuth: true, roles: ['therapist'], fullscreen: true }
    }
];

// ── Rotas de app — serão filhas do AppLayout compartilhado no index.js ────
export default {
    path: 'therapist',
    component: RouterPassthrough,
    meta: { area: 'therapist', requiresAuth: true, roles: ['therapist'] },

    children: [
        // ======================================================
        // 📊 DASHBOARD
        // ======================================================
        { path: '', name: 'therapist.dashboard', component: () => import('@/views/pages/therapist/TherapistDashboard.vue') },

        // ======================================================
        // 💬 CONVERSAS (CRM de WhatsApp)
        // ======================================================
        // Redirect pro layout Melissa (versão oficial). A `CRMConversasPage`
        // antiga continua no repo (sem rota apontando) até validarmos a versão
        // Melissa por algumas semanas; depois pode ser removida.
        {
            path: 'conversas',
            name: 'therapist-conversas',
            redirect: { name: 'Melissa', params: { secao: 'conversas' } }
        },

        // ======================================================
        // 📅 AGENDA
        // ======================================================
        {
            path: 'agenda',
            name: 'therapist-agenda',
            component: () => import('@/features/agenda/pages/AgendaTerapeutaPage.vue'),
            meta: { feature: 'agenda.view' }
        },

        // Recorrências
        {
            path: 'agenda/recorrencias',
            name: 'therapist-agenda-recorrencias',
            component: () => import('@/features/agenda/pages/AgendaRecorrenciasPage.vue'),
            meta: { feature: 'agenda.view', mode: 'therapist' }
        },

        // ✅ Compromissos determinísticos
        {
            path: 'agenda/compromissos',
            name: 'therapist-agenda-compromissos',
            component: () => import('@/features/agenda/pages/CompromissosDeterminados.vue'),
            meta: {
                feature: 'agenda.view',
                roles: ['therapist']
            }
        },

        // ======================================================
        // 💳 MEU PLANO
        // ======================================================
        {
            path: 'meu-plano',
            name: 'therapist-meu-plano',
            component: () => import('@/views/pages/billing/TherapistMeuPlanoPage.vue')
        },
        {
            path: 'upgrade',
            name: 'therapist-upgrade',
            component: () => import('@/views/pages/billing/TherapistUpgradePage.vue')
        },

        // ======================================================
        // 👥 PATIENTS
        // ======================================================
        {
            path: 'patients',
            name: 'therapist-patients',
            component: () => import('@/features/patients/PatientsListPage.vue')
        },
        {
            path: 'patients/cadastro',
            name: 'therapist-patients-create',
            component: () => import('@/features/patients/cadastro/PatientsCadastroPage.vue')
        },
        {
            path: 'patients/cadastro/:id',
            name: 'therapist-patients-edit',
            component: () => import('@/features/patients/cadastro/PatientsCadastroPage.vue'),
            props: true
        },
        {
            path: 'patients/grupos',
            name: 'therapist-patients-groups',
            component: () => import('@/features/patients/grupos/GruposPacientesPage.vue')
        },
        {
            path: 'patients/tags',
            name: 'therapist-patients-tags',
            component: () => import('@/features/patients/tags/TagsPage.vue')
        },
        {
            path: 'patients/medicos',
            name: 'therapist-patients-medicos',
            component: () => import('@/features/patients/medicos/MedicosPage.vue')
        },
        {
            path: 'patients/link-externo',
            name: 'therapist-patients-link-externo',
            component: () => import('@/features/patients/cadastro/PatientsExternalLinkPage.vue')
        },
        {
            path: 'patients/cadastro/recebidos',
            name: 'therapist-patients-recebidos',
            component: () => import('@/features/patients/cadastro/recebidos/CadastrosRecebidosPage.vue')
        },

        // ======================================================
        // 📄 DOCUMENTOS
        // ======================================================
        {
            path: 'documents',
            name: 'therapist-documents',
            component: () => import('@/features/documents/DocumentsListPage.vue'),
            meta: { feature: 'documents.upload' }
        },
        // /documents/templates removido — mudou pra /configuracoes/documentos/templates
        // (setup/config, não operação clínica).
        {
            path: 'patients/:id/documents',
            name: 'therapist-patient-documents',
            component: () => import('@/features/documents/DocumentsListPage.vue'),
            props: true,
            meta: { feature: 'documents.upload' }
        },

        // ======================================================
        // 🔒 PRO — Online Scheduling
        // ======================================================
        {
            path: 'online-scheduling',
            name: 'therapist-online-scheduling',
            component: () => import('@/views/pages/therapist/OnlineSchedulingPage.vue'),
            meta: { feature: 'online_scheduling.manage' }
        },

        // ======================================================
        // 🔒 PRO — Agendamentos Recebidos
        // ======================================================
        {
            path: 'agendamentos-recebidos',
            name: 'therapist-agendamentos-recebidos',
            component: () => import('@/features/agenda/pages/AgendamentosRecebidosPage.vue'),
            meta: { feature: 'online_scheduling.manage' }
        },

        // ======================================================
        // 💰 FINANCEIRO
        // ======================================================
        {
            path: 'financeiro',
            name: 'therapist-financeiro',
            component: () => import('@/features/financeiro/pages/FinanceiroDashboardPage.vue')
        },
        {
            path: 'financeiro/lancamentos',
            name: 'therapist-financeiro-lancamentos',
            component: () => import('@/features/financeiro/pages/FinanceiroPage.vue')
        },

        // ======================================================
        // 📈 RELATÓRIOS
        // ======================================================
        {
            path: 'relatorios',
            name: 'therapist-relatorios',
            component: () => import('@/views/pages/therapist/RelatoriosPage.vue'),
            meta: { feature: 'agenda.view' }
        },

        // ======================================================
        // 🔔 NOTIFICAÇÕES
        // ======================================================
        {
            path: 'notificacoes',
            name: 'therapist-notificacoes',
            component: () => import('@/views/pages/therapist/NotificationsHistoryPage.vue')
        },

        // ======================================================
        // 🔐 SECURITY
        // ======================================================
        {
            path: 'settings/security',
            name: 'therapist-settings-security',
            component: () => import('@/views/pages/auth/SecurityPage.vue')
        }
    ]
};
