import 'dotenv/config';
import { searchMessages, getProfile } from './dist/imap.js';

async function main() {
  try {
    console.log('GMAIL_EMAIL env:', process.env.GMAIL_EMAIL ? 'set' : 'NOT SET');
    console.log('GMAIL_APP_PASSWORD env:', process.env.GMAIL_APP_PASSWORD ? 'set' : 'NOT SET');
    console.log('Profile:', await getProfile('gmail'));
    const results = await searchMessages('test', 5, 'gmail');
    console.log('Results:', JSON.stringify(results, null, 2));
  } catch (err) {
    console.error('ERROR:', err.message);
    console.error(err.stack);
  }
}
main();
