-- Permissões RBAC para módulo Workflows

INSERT IGNORE INTO permissions (name, description, category) VALUES
('workflows.read', 'Visualizar workflows', 'workflows'),
('workflows.create', 'Criar workflows', 'workflows'),
('workflows.update', 'Editar workflows', 'workflows'),
('workflows.delete', 'Excluir workflows', 'workflows'),
('workflows.execute', 'Executar workflows', 'workflows');

-- 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 'workflows.%';

