INSERT IGNORE INTO roles(name) VALUES ('admin'),('user');

INSERT IGNORE INTO users(name,email,password_hash,role,status)
VALUES ('Administrador','admin@rkm.local','$2b$10$RdYB/pkxcZnRADgPRH0g1O8J5QOcwau2W8wOMPulSAfbA6unJJIdW','admin',1);

-- Permisos del sistema (todos asignados al admin)
INSERT IGNORE INTO permissions(name) VALUES
('dashboard_view'),
('notifications_view'),
('permissions_manage'),
('users_manage'),
('roles_manage'),
('migrations_manage');

-- Asociar todos los permisos al rol admin
INSERT IGNORE INTO role_permissions(role_id, permission_id)
SELECT r.id, p.id
FROM roles r, permissions p
WHERE r.name='admin';

-- Permisos básicos para el rol user
INSERT IGNORE INTO role_permissions(role_id, permission_id)
SELECT r.id, p.id
FROM roles r, permissions p
WHERE r.name='user' AND p.name IN ('dashboard_view','notifications_view');
