const https = require('https');
const http = require('http');

async function testLogin() {
  try {
    console.log('Testing school login API...');
    
    // Test school login
    const schoolCredentials = {
      email: 'school@test.com',
      password: Buffer.from('school123').toString('base64') // base64 encode
    };
    
    const response = await fetch('http://localhost:3002/api/auth/school/login', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify(schoolCredentials),
    });
    
    const data = await response.json();
    
    console.log('Response status:', response.status);
    console.log('Response data:', data);
    
    if (response.ok) {
      console.log('✓ Login successful!');
      console.log('Token:', data.token.substring(0, 20) + '...');
      console.log('User:', data.user);
    } else {
      console.log('✗ Login failed:', data.message);
    }
    
  } catch (error) {
    console.error('Test error:', error.message);
  }
}

testLogin();