
import { supabaseService } from '../src/services/SupabaseService.js';
import logger from '../src/utils/logger.js';

async function updateProfileName() {
    const profiles = await supabaseService.getActiveProfiles();
    if (profiles.length === 0) return;

    const targetProfile = profiles[0]; // The one we modified
    const newName = "High Risk Scalper ⚡";

    // Update Name in DB
    // @ts-ignore
    await supabaseService.client
        .from('trade_profiles')
        .update({ name: newName })
        .eq('id', targetProfile.id);

    logger.info(`✅ Profile Renamed to: [${newName}]`);
    logger.info(`📋 Active Rules for this Profile:`);

    // Display Rules
    const config = targetProfile.strategy_config;
    if (config && config.rules) {
        config.rules.forEach((r: any) => {
            logger.info(`   - ${r.ruleId}: ${r.enabled ? '🟢 ENABLED' : '🔴 OFF'}`);
        });
    } else {
        logger.info('   (Using Default Global Rules)');
    }
}

updateProfileName();
