-- Create Admin User Script
-- Run this to create a new admin user if needed
-- Password: admin123 (change immediately after login)

-- First, insert the user
INSERT INTO users (id, username, password_hash, first_name, last_name, email, must_change_password)
VALUES (
  UUID(),
  'admin',
  '$2a$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',
  'System',
  'Administrator',
  'admin@isb.fenwick.gov',
  FALSE
);

-- Then create the user profile
INSERT INTO user_profiles (id, user_id, role, badge_number, department, is_active)
SELECT 
  UUID(),
  id,
  'admin',
  'ISB-001',
  'Administration',
  TRUE
FROM users WHERE username = 'admin';

SELECT 'Admin user created successfully!' AS Status;
