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

async function check() {
    const app = await db.Application.findOne({ where: { applicationId: 'APP-TEST-001' } });
    if (!app) {
        console.log('Application APP-TEST-001 not found');
        return;
    }
    console.log(`Application Status: ${app.overallStatus}, Stage: ${app.currentStage}`);
    
    const loiReq = await db.LoiRequest.findOne({ where: { applicationId: app.id } });
    if (!loiReq) {
        console.log('LoiRequest not found for this application');
    } else {
        console.log(`LoiRequest Status: ${loiReq.status}`);
        const financeApproval = await db.LoiApproval.findOne({
            where: { requestId: loiReq.id, approverRole: 'Finance' }
        });
        console.log(`Finance Approval Action: ${financeApproval?.action || 'No record found'}`);
    }
    
    process.exit(0);
}

check();
