import fetch from 'node-fetch';

async function run() {
  try {
    const loginRes = await fetch('https://aluno.microtecinformaticacurso.com.br/api/portal/login', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        enrollmentNumber: 'MAT-202600005',
        password: '068467'
      })
    });
    const loginData = await loginRes.json();
    console.log('Login Response:', loginData);
    
    if (loginData.token) {
      const finRes = await fetch('https://aluno.microtecinformaticacurso.com.br/api/portal/financeiro', {
        headers: { Authorization: `Bearer ${loginData.token}` }
      });
      const finData = await finRes.json();
      console.log('Financeiro API Response:', JSON.stringify(finData, null, 2));
    }
  } catch (err) {
    console.error('Error during test:', err);
  }
}

run();
