-- Permissões RBAC para módulo IA

INSERT IGNORE INTO permissions (name, description, category) VALUES
('ia.read', 'Visualizar IA e previsões', 'ia'),
('ia.admin', 'Administrar modelos de IA', 'ia');

-- Adicionar permissões ao role admin
INSERT IGNORE INTO role_permissions (role_id, permission_id)
SELECT r.id, p.id
FROM roles r
CROSS JOIN permissions p
WHERE r.name = 'admin' AND p.name LIKE 'ia.%';

