-- Permissões para o módulo Workflows
INSERT IGNORE INTO permissions (name, description) VALUES
('workflows.read', 'Visualizar workflows e execuções'),
('workflows.create', 'Criar workflows'),
('workflows.update', 'Editar workflows'),
('workflows.delete', 'Excluir workflows'),
('workflows.execute', 'Executar workflows e aprovar/rejeitar');

-- Adicionar permissões ao grupo 'admin'
INSERT IGNORE INTO role_permissions (role_id, permission_id)
SELECT r.id, p.id FROM roles r, permissions p
WHERE r.name = 'admin' AND p.name IN (
    'workflows.read',
    'workflows.create',
    'workflows.update',
    'workflows.delete',
    'workflows.execute'
);

