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

const seedAutoAssignmentConfigs = async () => {
    try {
        console.log('--- Seeding Auto-Assignment Configurations ---');

        const configs = [
            {
                key: 'AUTO_ASSIGN_ONBOARDING',
                value: { enabled: true },
                category: 'ASSIGNMENT',
                description: 'Enable/Disable auto-assignment of participants for Onboarding module'
            },
            {
                key: 'AUTO_ASSIGN_RELOCATION',
                value: { enabled: true },
                category: 'ASSIGNMENT',
                description: 'Enable/Disable auto-assignment of participants for Relocation module'
            },
            {
                key: 'AUTO_ASSIGN_TERMINATION',
                value: { enabled: true },
                category: 'ASSIGNMENT',
                description: 'Enable/Disable auto-assignment of participants for Termination module'
            },
            {
                key: 'AUTO_ASSIGN_CONSTITUTIONAL',
                value: { enabled: true },
                category: 'ASSIGNMENT',
                description: 'Enable/Disable auto-assignment of participants for Constitutional module'
            },
            {
                key: 'AUTO_ASSIGN_RESIGNATION',
                value: { enabled: true },
                category: 'ASSIGNMENT',
                description: 'Enable/Disable auto-assignment of participants for Resignation module'
            },
            {
                key: 'AUTO_ASSIGN_FNF',
                value: { enabled: true },
                category: 'ASSIGNMENT',
                description: 'Enable/Disable auto-assignment of participants for F&F module'
            }
        ];

        for (const config of configs) {
            await db.SystemConfiguration.upsert({
                ...config,
                isActive: true
            });
            console.log(`Successfully seeded/updated: ${config.key}`);
        }

        console.log('--- Auto-Assignment Configurations Seeded Successfully ---');
        process.exit(0);
    } catch (error) {
        console.error('Error seeding auto-assignment configs:', error);
        process.exit(1);
    }
};

seedAutoAssignmentConfigs();
