import mongoose from 'mongoose';
import Event from '../server/models/event.js';

const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://localhost:27017/ghostguild';

async function checkEvents() {
  try {
    await mongoose.connect(MONGODB_URI);
    console.log('Connected to MongoDB');

    // Check events with the series
    const events = await Event.find({
      'series.id': 'coop-values-into-practice-2025'
    }).select('title series').lean();

    console.log(`\nFound ${events.length} events for series 'coop-values-into-practice-2025'\n`);
    
    events.forEach((event, index) => {
      console.log(`${index + 1}. ${event.title}`);
      console.log(`   series.id: ${event.series?.id}`);
      console.log(`   series.isSeriesEvent: ${event.series?.isSeriesEvent}`);
      console.log('');
    });

  } catch (error) {
    console.error('Error:', error);
  } finally {
    await mongoose.connection.close();
  }
}

checkEvents();
