package com.mingliqiye.minecraft.enchantment.conflict.enchantment;

import com.mingliqiye.minecraft.enchantment.conflict.config.ModConfig;

import java.util.Arrays;
import java.util.List;

public class DamageEnchantment extends Enchantment {

    private final String id;

    public DamageEnchantment(String id) {
        this.id = id;
    }

    private final static List<String> enchantmentIds =
            Arrays.asList("minecraft:sharpness", "minecraft:smite", "minecraft:bane_of_arthropods", "minecraft:density",
                    "minecraft:breach");

    public static DamageEnchantment ofId(String id) {
        if (enchantmentIds.contains(id)) {
            return new DamageEnchantment(id);
        }
        return null;
    }

    public Boolean canBeCombined(Enchantment enchantment) {
        if (enchantment instanceof DamageEnchantment) {
            return ModConfig.getInstance().isAllowDamageEnchantment();
        }
        return super.canBeCombined(enchantment);
    }

    public String getId() {
        return id;
    }
}
