"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SetConfig = void 0;
const serverManager_js_1 = require("../server/serverManager.js");
class SetConfig {
    configRepository;
    constructor(configRepository) {
        this.configRepository = configRepository;
    }
    async execute(key, value) {
        await this.configRepository.setValue(key, value);
        // Handle server-specific settings
        if (key === 'server.enabled') {
            const serverManager = serverManager_js_1.ServerManager.getInstance();
            if (value === 'false') {
                // Stop the server if it's being disabled
                await serverManager.stopServer();
            }
            else {
                // Start the server if it's being enabled
                await serverManager.startServer();
            }
        }
        return true;
    }
}
exports.SetConfig = SetConfig;
//# sourceMappingURL=setConfig.js.map