const db = require('./config/database');

async function checkParent() {
  try {
    console.log('Checking for parent users...');
    
    // Check all parent users
    const [parents] = await db.execute('SELECT id, email, first_name, last_name, user_type, school_id FROM users WHERE user_type = "parent"');
    console.log('Parent users found:', parents.length);
    
    parents.forEach(parent => {
      console.log(`- ID: ${parent.id}, Email: ${parent.email}, Name: ${parent.first_name} ${parent.last_name}, School ID: ${parent.school_id}`);
    });
    
    // Check the specific parent
    const [specificParent] = await db.execute('SELECT * FROM users WHERE email = "mukund.jadhav30@tenerity.com"');
    console.log('\nSpecific parent (mukund.jadhav30@tenerity.com):', specificParent);
    
    // Check all users to see what's there
    const [allUsers] = await db.execute('SELECT id, email, first_name, last_name, user_type, school_id FROM users ORDER BY id DESC LIMIT 10');
    console.log('\nRecent users:');
    allUsers.forEach(user => {
      console.log(`- ID: ${user.id}, Email: ${user.email}, Name: ${user.first_name} ${user.last_name}, Type: ${user.user_type}, School ID: ${user.school_id}`);
    });
    
    process.exit(0);
  } catch (error) {
    console.error('Error:', error);
    process.exit(1);
  }
}

checkParent();