import db from '../database/models/index.js';

const checkInterviews = async () => {
    try {
        const interviews = await db.Interview.findAll({
            include: [{
                model: db.InterviewParticipant,
                as: 'participants',
                include: [{ model: db.User, as: 'user' }]
            }]
        });

        // console.log(`--- Interviews ---`);
        interviews.forEach((i: any) => {
            console.log(`ID: ${i.id}, AppUUID: ${i.applicationId}, Level: ${i.level}, Status: ${i.status}`);
            i.participants?.forEach((p: any) => {
                console.log(`  - Participant: ${p.user?.name} (${p.user?.role}), Status: ${p.status}`);
            });
        });
        process.exit(0);
    } catch (err) {
        console.error(err);
        process.exit(1);
    }
};

checkInterviews();
