package me.km.items;

import java.util.function.Supplier;
import net.minecraft.item.Items;
import net.minecraft.item.IItemTier;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.LazyValue;

public enum ModItemTier implements IItemTier {
    COPPER(1, 161, 6.0f, 1.0f, 18, () -> Ingredient.fromItems(ModItems.copperIngot)),
    BRONZE(2, 208, 7.0f, 1.5f, 15, () -> Ingredient.fromItems(ModItems.bronzeIngot)),
    REDSTONE(0, 59, 1.0f, 0.0f, 22, () -> Ingredient.fromItems(Items.REDSTONE)),
    SILVER(2, 250, 5.0f, 2.0f, 20, () -> Ingredient.fromItems(ModItems.silverIngot)),
    EMERALD(0, 1248, 7.0f, 2.5f, 10, () -> Ingredient.fromItems(Items.EMERALD)),
    LAPIS(0, 131, 4.0f, 1.0f, 15, () -> Ingredient.fromItems(Items.LAPIS_LAZULI));

    private final int harvestLevel;
    private final int maxUses;
    private final float efficiency;
    private final float attackDamage;
    private final int enchantability;
    private final LazyValue<Ingredient> repairMaterial;

    private ModItemTier(int harvestLevelIn, int maxUsesIn, float efficiencyIn, float attackDamageIn, int enchantabilityIn, Supplier<Ingredient> repairMaterialIn) {
        this.harvestLevel = harvestLevelIn;
        this.maxUses = maxUsesIn;
        this.efficiency = efficiencyIn;
        this.attackDamage = attackDamageIn;
        this.enchantability = enchantabilityIn;
        this.repairMaterial = new LazyValue<>(repairMaterialIn);
    }

    @Override
    public int getMaxUses() {
        return this.maxUses;
    }

    @Override
    public float getEfficiency() {
        return this.efficiency;
    }

    @Override
    public float getAttackDamage() {
        return this.attackDamage;
    }

    @Override
    public int getHarvestLevel() {
        return this.harvestLevel;
    }

    @Override
    public int getEnchantability() {
        return this.enchantability;
    }

    @Override
    public Ingredient getRepairMaterial() {
        return this.repairMaterial.getValue();
    }
}
