const admin = require('firebase-admin');
const serviceAccount = require('./serviceAccountKey.json');

admin.initializeApp({
  credential: admin.credential.cert(serviceAccount)
});

const db = admin.firestore();

async function checkPhase() {
  const projectId = 'ivmEUWmdBrY9M5QDuBsJ';
  const projectDoc = await db.collection('projects').doc(projectId).get();
  
  if (!projectDoc.exists) {
    console.log('Project not found');
    return;
  }
  
  const data = projectDoc.data();
  console.log('\n=== PROJECT PHASE DATA ===');
  console.log('Current Phase:', data.currentPhase);
  console.log('Phase Status:', data.phaseStatus);
  console.log('Phase Data:', JSON.stringify(data.phaseData, null, 2));
  console.log('\n=== EXPECTED vs ACTUAL ===');
  console.log('Expected Phase: gathering');
  console.log('Actual Phase:', data.currentPhase);
  console.log('Match:', data.currentPhase === 'gathering' ? '✅ YES' : '❌ NO');
}

checkPhase().then(() => process.exit(0)).catch(err => {
  console.error('Error:', err);
  process.exit(1);
});
