-- Adiciona permissões para os dashboards
-- Execute este script no banco de dados

INSERT INTO permissions (key_name, name, module) VALUES
-- Dashboards
('dashboard.view', 'Visualizar Dashboard Principal', 'Dashboard'),
('dashboard.financial', 'Visualizar Dashboard Financeiro', 'Dashboard'),
('dashboard.reports', 'Visualizar Dashboard Relatórios', 'Dashboard')
ON DUPLICATE KEY UPDATE name = name;

-- Associa as permissões de dashboard ao Administrador (role_id = 1)
INSERT INTO role_permissions (role_id, permission_id)
SELECT 1, id FROM permissions WHERE key_name IN ('dashboard.view', 'dashboard.financial', 'dashboard.reports')
ON DUPLICATE KEY UPDATE role_id = role_id;

