package eu.mhsl.minecraft.pixelblocks;

import org.bukkit.configuration.file.FileConfiguration;
import org.jetbrains.annotations.NotNull;

public record PixelBlockConfiguration(
    int pixelsPerBlock,
    boolean onlyBreakableByOwner,
    boolean onlyEditableByOwner
) {
    public static void setDefaults(FileConfiguration config) {
        config.addDefault(Keys.PixelsPerBlock.getKey(), 16);
        config.addDefault(Keys.OnlyBreakableByOwners.getKey(), false);
        config.addDefault(Keys.OnlyEditableByOwners.getKey(), true);
        config.options().copyDefaults(true);
    }

    public enum Keys {
        PixelsPerBlock("pixelsPerBlock"),
        OnlyBreakableByOwners("onlyBreakableByOwners"),
        OnlyEditableByOwners("onlyEditableByOwners");

        private final String key;

        Keys(@NotNull String key) {
            this.key = key;
        }

        public @NotNull String getKey() {
            return key;
        }
    }
}
