package com.tiedup.remake.items.base;

import com.tiedup.remake.util.GagMaterial;

/**
 * Enum defining all gag variants with their properties.
 * Used by GenericGag to create gag items via factory pattern.
 *
 * <p>Note: ItemMedicalGag is NOT included here because it implements
 * IHasBlindingEffect (combo item with special behavior).
 *
 * <p><b>Issue #12 fix:</b> Added textureSubfolder to eliminate 40+ string checks in renderers.
 */
public enum GagVariant {
    // Cloth-based gags
    CLOTH_GAG("cloth_gag", GagMaterial.CLOTH, true, "cloth", false, null),
    ROPES_GAG("ropes_gag", GagMaterial.CLOTH, true, "shibari", false, null),
    CLEAVE_GAG("cleave_gag", GagMaterial.CLOTH, true, "cleave", false, null),
    RIBBON_GAG("ribbon_gag", GagMaterial.CLOTH, false, "ribbon", false, null),

    // Ball gags - standard 2D texture rendering
    BALL_GAG(
        "ball_gag",
        GagMaterial.BALL,
        true,
        "ballgags/normal",
        false,
        null
    ),
    BALL_GAG_STRAP(
        "ball_gag_strap",
        GagMaterial.BALL,
        true,
        "ballgags/harness",
        false,
        null
    ),

    // Tape gags
    TAPE_GAG("tape_gag", GagMaterial.TAPE, true, "tape", false, null),

    // Stuffed/filling gags (no colors)
    WRAP_GAG("wrap_gag", GagMaterial.STUFFED, false, "wrap", false, null),
    SLIME_GAG("slime_gag", GagMaterial.STUFFED, false, "slime", false, null),
    VINE_GAG("vine_gag", GagMaterial.STUFFED, false, "vine", false, null),
    WEB_GAG("web_gag", GagMaterial.STUFFED, false, "web", false, null),

    // Panel gags (no colors)
    PANEL_GAG(
        "panel_gag",
        GagMaterial.PANEL,
        false,
        "straitjacket",
        false,
        null
    ),
    BEAM_PANEL_GAG(
        "beam_panel_gag",
        GagMaterial.PANEL,
        false,
        "beam",
        false,
        null
    ),
    CHAIN_PANEL_GAG(
        "chain_panel_gag",
        GagMaterial.PANEL,
        false,
        "chain",
        false,
        null
    ),

    // Latex gags (no colors)
    LATEX_GAG("latex_gag", GagMaterial.LATEX, false, "latex", false, null),

    // Ring/tube gags (no colors)
    TUBE_GAG("tube_gag", GagMaterial.RING, false, "tube", false, null),

    // Bite gags (no colors)
    BITE_GAG("bite_gag", GagMaterial.BITE, false, "armbinder", false, null),

    // Sponge gags (no colors)
    SPONGE_GAG("sponge_gag", GagMaterial.SPONGE, false, "sponge", false, null),

    // Baguette gags (no colors)
    BAGUETTE_GAG(
        "baguette_gag",
        GagMaterial.BAGUETTE,
        false,
        "baguette",
        false,
        null
    );

    private final String registryName;
    private final GagMaterial material;
    private final boolean supportsColor;
    private final String textureSubfolder;
    private final boolean uses3DModel;
    private final String modelPath;

    GagVariant(
        String registryName,
        GagMaterial material,
        boolean supportsColor,
        String textureSubfolder,
        boolean uses3DModel,
        String modelPath
    ) {
        this.registryName = registryName;
        this.material = material;
        this.supportsColor = supportsColor;
        this.textureSubfolder = textureSubfolder;
        this.uses3DModel = uses3DModel;
        this.modelPath = modelPath;
    }

    public String getRegistryName() {
        return registryName;
    }

    public GagMaterial getMaterial() {
        return material;
    }

    /**
     * Check if this gag variant supports color variations.
     * Items with colors: cloth_gag, ropes_gag, cleave_gag, ribbon_gag,
     *                    ball_gag, ball_gag_strap, tape_gag
     */
    public boolean supportsColor() {
        return supportsColor;
    }

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

    /**
     * Check if this gag variant uses a 3D OBJ model.
     *
     * @return true if this variant uses a 3D model
     */
    public boolean uses3DModel() {
        return uses3DModel;
    }

    /**
     * Get the model path for 3D rendering.
     *
     * @return ResourceLocation string path (e.g., "tiedup:models/obj/ball_gag.obj"), or null if no 3D model
     */
    public String getModelPath() {
        return modelPath;
    }
}
