require('dotenv').config();
const db = require('./db');
const settingsController = require('./controllers/settingsController');

async function testPublicSettings() {
    try {
        const req = {};
        const res = {
            json: (data) => {
                console.log('--- TEST RESULTS ---');
                console.log('Monthly Plan:', data.plan_monthly_name);
                console.log('Monthly Price:', data.stripe_price_original_monthly);
                console.log('Monthly Discount:', data.discount_monthly_percent, '%');
                console.log('Yearly Plan:', data.plan_yearly_name);
                console.log('Yearly Price:', data.stripe_price_original_yearly);
                console.log('--------------------');
                process.exit(0);
            },
            status: (code) => {
                return {
                    json: (data) => {
                        console.error('Error:', code, data);
                        process.exit(1);
                    }
                }
            }
        };
        
        console.log('Calling getPublicSettings...');
        await settingsController.getPublicSettings(req, res);
    } catch (e) {
        console.error('Failed test:', e);
        process.exit(1);
    }
}

testPublicSettings();
