import { readFileSync, writeFileSync } from 'fs';
import { join } from 'path';

const configPath = join(process.cwd(), 'config', 'config.json');

export const configManager = {
    toggleCommand: (commandName: string, enabled: boolean) => {
        const raw = readFileSync(configPath, 'utf-8');
        const data = JSON.parse(raw);

        if (!data.commands) {
            data.commands = {};
        }

        data.commands[commandName] = enabled;

        writeFileSync(configPath, JSON.stringify(data, null, 4));
    }
};
