const bcrypt = require('bcrypt');

async function createAdminUser() {
  // Password to hash
  const password = 'admin123';

  // Generate salt and hash
  const saltRounds = 10;
  const hash = await bcrypt.hash(password, saltRounds);

  console.log('Password:', password);
  console.log('Hash:', hash);

  // SQL command
  const sql = `
INSERT INTO admin_users (email, password_hash, name, role)
VALUES (
    'admin@parentflowapp.com',
    '${hash}',
    'System Administrator',
    'super_admin'
) ON CONFLICT (email)
DO UPDATE SET
    password_hash = '${hash}',
    updated_at = CURRENT_TIMESTAMP;
  `;

  console.log('\nSQL Command:');
  console.log(sql);
}

createAdminUser().catch(console.error);