package com.tiedup.remake.items.base;

/**
 * Enum defining all bind variants with their properties.
 * Used by GenericBind to create bind items via factory pattern.
 *
 * <p><b>Issue #12 fix:</b> Added textureSubfolder to eliminate 40+ string checks in renderers.
 */
public enum BindVariant {
    // Standard binds (PoseType.STANDARD)
    ROPES("ropes", PoseType.STANDARD, true, "ropes"),
    ARMBINDER("armbinder", PoseType.STANDARD, false, "armbinder"),
    DOGBINDER("dogbinder", PoseType.DOG, false, "armbinder"),
    CHAIN("chain", PoseType.STANDARD, false, "chain"),
    RIBBON("ribbon", PoseType.STANDARD, false, "ribbon"),
    SLIME("slime", PoseType.STANDARD, false, "slime"),
    VINE_SEED("vine_seed", PoseType.STANDARD, false, "vine"),
    WEB_BIND("web_bind", PoseType.STANDARD, false, "web"),
    SHIBARI("shibari", PoseType.STANDARD, true, "shibari"),
    LEATHER_STRAPS("leather_straps", PoseType.STANDARD, false, "straps"),
    MEDICAL_STRAPS("medical_straps", PoseType.STANDARD, false, "straps"),
    BEAM_CUFFS("beam_cuffs", PoseType.STANDARD, false, "beam"),
    DUCT_TAPE("duct_tape", PoseType.STANDARD, true, "tape"),

    // Pose items (special PoseType)
    STRAITJACKET("straitjacket", PoseType.STRAITJACKET, false, "straitjacket"),
    WRAP("wrap", PoseType.WRAP, false, "wrap"),
    LATEX_SACK("latex_sack", PoseType.LATEX_SACK, false, "latex");

    private final String registryName;
    private final PoseType poseType;
    private final boolean supportsColor;
    private final String textureSubfolder;

    BindVariant(
        String registryName,
        PoseType poseType,
        boolean supportsColor,
        String textureSubfolder
    ) {
        this.registryName = registryName;
        this.poseType = poseType;
        this.supportsColor = supportsColor;
        this.textureSubfolder = textureSubfolder;
    }

    public String getRegistryName() {
        return registryName;
    }

    /**
     * Get the configured resistance for this bind variant.
     * Delegates to {@link com.tiedup.remake.core.SettingsAccessor#getBindResistance(String)}.
     */
    public int getResistance() {
        return com.tiedup.remake.core.SettingsAccessor.getBindResistance(
            registryName
        );
    }

    public PoseType getPoseType() {
        return poseType;
    }

    /**
     * Check if this bind variant supports color variations.
     * Items with colors: ropes, shibari, duct_tape
     */
    public boolean supportsColor() {
        return supportsColor;
    }

    /**
     * Get the texture subfolder for this bind variant.
     * Used by renderers to locate texture files.
     *
     * @return Subfolder path under textures/entity/bondage/ (e.g., "ropes", "straps")
     */
    public String getTextureSubfolder() {
        return textureSubfolder;
    }

    /**
     * Get the item name used for textures and translations.
     * For most variants this is the same as registryName.
     */
    public String getItemName() {
        return registryName;
    }
}
