package com.tiedup.remake.items;

import com.tiedup.remake.items.base.BindVariant;
import com.tiedup.remake.items.base.ItemBind;
import com.tiedup.remake.items.base.PoseType;
import net.minecraft.world.item.Item;

/**
 * Generic bind item created from BindVariant enum.
 * Replaces individual bind classes (ItemRopes, ItemChain, ItemStraitjacket, etc.)
 *
 * Factory pattern: All bind variants are created using this single class.
 */
public class GenericBind extends ItemBind {

    private final BindVariant variant;

    public GenericBind(BindVariant variant) {
        super(new Item.Properties().stacksTo(16));
        this.variant = variant;
    }

    @Override
    public String getItemName() {
        return variant.getItemName();
    }

    @Override
    public PoseType getPoseType() {
        return variant.getPoseType();
    }

    /**
     * Get the variant this bind was created from.
     */
    public BindVariant getVariant() {
        return variant;
    }

    /**
     * Get the default resistance value for this bind variant.
     * Note: Actual resistance is managed by GameRules, this is just the configured default.
     */
    public int getDefaultResistance() {
        return variant.getResistance();
    }

    /**
     * Check if this bind can have a padlock attached via anvil.
     * Adhesive (tape) and organic (slime, vine, web) binds cannot have padlocks.
     */
    @Override
    public boolean canAttachPadlock() {
        return switch (variant) {
            case DUCT_TAPE, SLIME, VINE_SEED, WEB_BIND -> false;
            default -> true;
        };
    }

    /**
     * Get the texture subfolder for this bind variant.
     * Issue #12 fix: Eliminates string checks in renderers.
     */
    @Override
    public String getTextureSubfolder() {
        return variant.getTextureSubfolder();
    }
}
