package top.leisuretimedock.dglabgame.config;

import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeConfigSpec;

@OnlyIn(Dist.CLIENT)
public class ClientConfig {
    public static final ForgeConfigSpec SPEC;

    public static final ForgeConfigSpec.BooleanValue ENABLE_SSL;
    public static final ForgeConfigSpec.IntValue CONNECTION_TIMEOUT;
    public static final ForgeConfigSpec.ConfigValue<java.util.List<? extends String>> FEEDBACK_PRESETS;

    static {
        ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();

        builder.push("connection");
        ENABLE_SSL = builder
                .comment("Whether to use SSL/WSS for the WebSocket connection to the DGLab relay.",
                        "Requires a valid SSL certificate on the relay server side.")
                .define("enableSSL", false);
        CONNECTION_TIMEOUT = builder
                .comment("Connection timeout in milliseconds for WebSocket handshake.")
                .defineInRange("connectionTimeout", 5000, 1000, 30000);
        builder.pop();

        builder.push("feedback");
        FEEDBACK_PRESETS = builder
                .comment("Preset feedback message labels.",
                        "These appear as quick-select buttons in the management GUI.")
                .defineList("presets",
                        java.util.List.of("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"),
                        o -> o instanceof String && !((String) o).isBlank());
        builder.pop();

        SPEC = builder.build();
    }
}
