const fs = require('fs');

// Simple test to see if components load properly
try {
  // Check if StatusOverview component exists and can be imported
  const statusOverviewPath = './components/StatusOverview.js';
  if (fs.existsSync(statusOverviewPath)) {
    console.log('✅ StatusOverview.js exists');
    const content = fs.readFileSync(statusOverviewPath, 'utf8');
    
    // Check for potential runtime issues
    if (content.includes('useEffect')) {
      console.log('✅ Component uses useEffect');
    }
    if (content.includes('useState')) {
      console.log('✅ Component uses useState');
    }
    if (content.includes('fetch(')) {
      console.log('✅ Component makes fetch calls');
      
      // Extract API endpoints being called
      const fetchCalls = content.match(/fetch\(['"`]([^'"`]+)['"`]\)/g);
      if (fetchCalls) {
        console.log('📡 API endpoints called:');
        fetchCalls.forEach(call => {
          const endpoint = call.match(/['"`]([^'"`]+)['"`]/)[1];
          console.log(`   - ${endpoint}`);
        });
      }
    }
  } else {
    console.log('❌ StatusOverview.js not found');
  }
  
  // Check page.js
  const pagePath = './app/page.js';
  if (fs.existsSync(pagePath)) {
    console.log('✅ page.js exists');
  } else {
    console.log('❌ page.js not found');
  }
  
} catch (error) {
  console.error('Debug error:', error.message);
}
