"use strict";
/**
 * 📧 faf notifications - Version update notifications management
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.notificationsCommand = notificationsCommand;
const colors_1 = require("../fix-once/colors");
const email_opt_in_1 = require("../utils/email-opt-in");
async function notificationsCommand(options = {}) {
    try {
        // Show status
        if (options.status) {
            (0, email_opt_in_1.showSubscriptionStatus)();
            return;
        }
        // Remove email
        if (options.remove) {
            (0, email_opt_in_1.unsubscribe)();
            return;
        }
        // Add email directly
        if (options.email) {
            await (0, email_opt_in_1.subscribeViaFlag)(options.email);
            return;
        }
        // Interactive add email
        await (0, email_opt_in_1.promptEmailOptIn)({ quiet: options.quiet });
    }
    catch (error) {
        console.log(colors_1.chalk.red('Error managing notifications:'));
        console.log(colors_1.chalk.red(error instanceof Error ? error.message : String(error)));
        process.exit(1);
    }
}
//# sourceMappingURL=notifications.js.map