-- Add Backup and OAuth Diagnostics permissions for Standalone User Dashboard

INSERT INTO programs (program_code, program_name, is_active, created_at)
VALUES ('ACCESS_DASHBOARD', 'Access Dashboard', 1, NOW())
ON DUPLICATE KEY UPDATE program_name = VALUES(program_name), is_active = 1;

INSERT INTO permissions (program_id, permission_key, permission_name, permission_group, description, is_active, created_at)
SELECT p.id, 'security_backup_manage', 'Manage Security Backup', 'Security', 'Create, download and delete standalone auth module backups.', 1, NOW()
FROM programs p
WHERE p.program_code = 'ACCESS_DASHBOARD'
ON DUPLICATE KEY UPDATE
    permission_name = VALUES(permission_name),
    permission_group = VALUES(permission_group),
    description = VALUES(description),
    is_active = 1;

INSERT INTO permissions (program_id, permission_key, permission_name, permission_group, description, is_active, created_at)
SELECT p.id, 'security_otp_manage', 'Manage Google OTP Settings', 'Security', 'Manage Google OAuth OTP settings and diagnostics.', 1, NOW()
FROM programs p
WHERE p.program_code = 'ACCESS_DASHBOARD'
ON DUPLICATE KEY UPDATE
    permission_name = VALUES(permission_name),
    permission_group = VALUES(permission_group),
    description = VALUES(description),
    is_active = 1;
