package de.winniepat.citrus.managers;

import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;

public class FullbrightManager {
    private static final double BRIGHT_VALUE = 15.0;
    private static final double NORMAL_VALUE = 1.0;

    public static void toggle(MinecraftClient client) {
        ConfigManager.config.fullbrightEnabled = !ConfigManager.config.fullbrightEnabled;
        ConfigManager.save();

        apply(client);

        if (client.player != null) {
            String status = ConfigManager.config.fullbrightEnabled ? "§aON" : "§cOFF";
            client.player.sendMessage(Text.literal("Fullbright: " + status), true);
        }
    }

    public static void apply(MinecraftClient client) {
        if (client == null || client.options == null) return;

        double target = ConfigManager.config.fullbrightEnabled ? BRIGHT_VALUE : NORMAL_VALUE;
        client.options.getGamma().setValue(target);
    }
}