package xyz.quickbasic.tieredrepairkits.config;

import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;

public class RecipeIngredient {

    public static final BuilderCodec<RecipeIngredient> CODEC =
        BuilderCodec.builder(RecipeIngredient.class, RecipeIngredient::new)
            .append(new KeyedCodec<>("ItemId", Codec.STRING),
                    (obj, value) -> obj.itemId = value,
                    obj -> obj.itemId).add()
            .append(new KeyedCodec<>("Quantity", Codec.INTEGER),
                    (obj, value) -> obj.quantity = value,
                    obj -> obj.quantity).add()
            .build();

    private String itemId = "Ingredient_Fibre";
    private int quantity = 1;

    public RecipeIngredient() {}

    public RecipeIngredient(String itemId, int quantity) {
        this.itemId = itemId;
        this.quantity = quantity;
    }

    public String getItemId() {
        return itemId;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setItemId(String itemId) {
        this.itemId = itemId;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }
}