-- ============================================
-- COMPLETE ADMIN PASSWORD RESET
-- ============================================
-- 
-- This script will:
-- 1. Delete existing admin (if exists)
-- 2. Create fresh admin with correct password hash
--
-- INSTRUCTIONS:
-- 1. Generate a NEW bcrypt hash at: https://bcrypt-generator.com/
--    - Password: admin123 (or your choice)
--    - Rounds: 10
--    - Copy the complete hash (60 characters)
--
-- 2. Replace values below:
--    - 'PASTE_FRESH_HASH_HERE' → Your new bcrypt hash
--    - 'admin@yourdomain.com' → Your admin email
--    - '+1234567890' → Your phone number
--
-- 3. Execute in phpMyAdmin SQL tab
--
-- ============================================

-- Step 1: Delete existing admin (if exists)
DELETE FROM `users` WHERE `email` = 'admin@yourdomain.com';  -- ⬅️ CHANGE EMAIL

-- Step 2: Insert fresh admin with correct hash
INSERT INTO `users` (
  `name`, 
  `email`, 
  `password`, 
  `contactNumber`, 
  `role`, 
  `isActive`, 
  `passwordSet`, 
  `createdAt`, 
  `updatedAt`
) VALUES (
  'Admin User',
  'admin@yourdomain.com',  -- ⬅️ CHANGE EMAIL
  'PASTE_FRESH_HASH_HERE',  -- ⬅️ PASTE YOUR BCRYPT HASH (60 chars)
  '+1234567890',  -- ⬅️ CHANGE PHONE
  'admin',
  TRUE,
  TRUE,
  NOW(),
  NOW()
);

-- ============================================
-- QUICK RESET: Use 'admin123' password
-- ============================================
-- Uncomment and use this for quick reset:
--
-- DELETE FROM `users` WHERE `email` = 'admin@yourdomain.com';
--
-- INSERT INTO `users` (
--   `name`, `email`, `password`, `contactNumber`, `role`, `isActive`, `passwordSet`, `createdAt`, `updatedAt`
-- ) VALUES (
--   'Admin User',
--   'admin@yourdomain.com',  -- ⬅️ CHANGE EMAIL
--   '$2a$10$N9qo8uLOickgx2ZMRZoMyeIjZAgcfl7p92ldGxad68LJZdL17lhWy',  -- Hash for 'admin123'
--   '+1234567890',  -- ⬅️ CHANGE PHONE
--   'admin',
--   TRUE,
--   TRUE,
--   NOW(),
--   NOW()
-- );
--
-- ⚠️ WARNING: Change password immediately after login!
-- ============================================
