-- Inserir roles simplificados
INSERT INTO security.roles (id, role_code, name, display_name, description, permissions, parent_role_id, level, is_active, is_system, created_at, updated_at) VALUES 
(6, 'ROLE0016', 'SUPER_ADMIN', 'Super Administrator', 'Super administrator with full system access', '{"level": "SYSTEM", "permissions": ["ALL"]}', NULL, 0, true, true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(7, 'ROLE0017', 'COMPANY_ADMIN', 'Company Administrator', 'Administrator with full access to company resources', '{"level": "COMPANY", "permissions": ["COMPANY_ALL"]}', NULL, 0, true, true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(8, 'ROLE0018', 'SOCIAL_MANAGER', 'Social Media Manager', 'Manager with access to social media operations', '{"level": "DEPARTMENT", "permissions": ["SOCIAL_ALL", "CONTENT_ALL"]}', NULL, 0, true, true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(9, 'ROLE0019', 'CONTENT_CREATOR', 'Content Creator', 'Creator with access to content creation and posting', '{"level": "USER", "permissions": ["CONTENT_CREATE", "CONTENT_READ"]}', NULL, 0, true, true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(10, 'ROLE0020', 'ANALYST', 'Analytics Analyst', 'Analyst with read-only access to analytics and reports', '{"level": "USER", "permissions": ["ANALYTICS_READ", "REPORTS_READ"]}', NULL, 0, true, true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
ON CONFLICT (id) DO NOTHING;

-- Inserir mais permissions
INSERT INTO security.permissions (id, permission_code, name, display_name, description, resource, action, category, is_active, is_system, created_at, updated_at) VALUES 
(11, 'SOC_U', 'SOCIAL_ACCOUNT_UPDATE', 'Update Social Accounts', 'Update social media account settings', 'SOCIAL_ACCOUNT', 'UPDATE', 'SOCIAL_MANAGEMENT', true, true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(12, 'SOC_D', 'SOCIAL_ACCOUNT_DELETE', 'Delete Social Accounts', 'Remove social media accounts', 'SOCIAL_ACCOUNT', 'DELETE', 'SOCIAL_MANAGEMENT', true, true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(13, 'CONT_C', 'CONTENT_CREATE', 'Create Content', 'Create new content and posts', 'CONTENT', 'CREATE', 'CONTENT_MANAGEMENT', true, true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(14, 'CONT_R', 'CONTENT_READ', 'View Content', 'View content and posts', 'CONTENT', 'READ', 'CONTENT_MANAGEMENT', true, true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(15, 'CONT_U', 'CONTENT_UPDATE', 'Update Content', 'Edit existing content and posts', 'CONTENT', 'UPDATE', 'CONTENT_MANAGEMENT', true, true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(16, 'CONT_D', 'CONTENT_DELETE', 'Delete Content', 'Delete content and posts', 'CONTENT', 'DELETE', 'CONTENT_MANAGEMENT', true, true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(17, 'CONT_P', 'CONTENT_PUBLISH', 'Publish Content', 'Publish content to social media platforms', 'CONTENT', 'PUBLISH', 'CONTENT_MANAGEMENT', true, true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(18, 'CONT_S', 'CONTENT_SCHEDULE', 'Schedule Content', 'Schedule content for future publishing', 'CONTENT', 'SCHEDULE', 'CONTENT_MANAGEMENT', true, true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(19, 'MEDIA_C', 'MEDIA_UPLOAD', 'Upload Media', 'Upload images, videos and other media', 'MEDIA', 'CREATE', 'MEDIA_MANAGEMENT', true, true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP),
(20, 'MEDIA_R', 'MEDIA_READ', 'View Media', 'View media library', 'MEDIA', 'READ', 'MEDIA_MANAGEMENT', true, true, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP)
ON CONFLICT (id) DO NOTHING;
