-- ╔══════════════════════════════════════════════════════════════╗
-- ║  HR Portal — Mock Data Cleanup                               ║
-- ║  Run this in phpMyAdmin → SQL tab                            ║
-- ╚══════════════════════════════════════════════════════════════╝

SET FOREIGN_KEY_CHECKS = 0;

-- 1. Remove all leave requests (linked to mock employees)
DELETE FROM leave_requests;

-- 2. Remove all attendance records (linked to mock employees)
DELETE FROM attendance_records;

-- 3. Remove all leave balances (linked to mock employees)
DELETE FROM leave_balance;

-- 4. Remove all documents (linked to mock employees)
DELETE FROM documents;

-- 5. Remove all mock employee records
DELETE FROM employees;

-- 6. Remove mock employee login accounts (keep hr, admin, superadmin)
DELETE FROM users WHERE role = 'employee';

-- 7. Remove all mock departments
DELETE FROM departments;

-- 8. Clear all notifications
DELETE FROM notifications;

SET FOREIGN_KEY_CHECKS = 1;

-- Verify cleanup
SELECT 'employees' AS tbl, COUNT(*) AS remaining FROM employees
UNION ALL SELECT 'users (employees)', COUNT(*) FROM users WHERE role='employee'
UNION ALL SELECT 'attendance_records', COUNT(*) FROM attendance_records
UNION ALL SELECT 'leave_requests', COUNT(*) FROM leave_requests
UNION ALL SELECT 'departments', COUNT(*) FROM departments;
