/*
    SPDX-FileCopyrightText: 2026 Vlad Zahorodnii <vlad.zahorodnii@kde.org>

    SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/

#include "command/output/cmd.h"

static QStringList arguments;
OUTPUT_COMMAND_POSITIONAL_OPTION(
    "SOURCE",
    &arguments
)

static int run(KScreen::OutputPtr output, KScreen::ConfigPtr config)
{
    const auto source = parseColorProfileSource(arguments[0]);
    if (!source) {
        std::println(std::cerr, "Invalid argument: {}", arguments[0].toStdString());
        return 1;
    }

    if (source == KScreen::Output::ColorProfileSource::sRGB) {
        std::println(std::cerr, "sRGB color profile source with the HDR mode is unsupported");
        return 1;
    }

    output->setColorProfileSource(*source);
    return applyConfig(config);
}

OUTPUT_COMMAND(run, "Set color profile source (possible values: EDID, or ICC)", "Color Management")
