package com.tiedup.remake.items.base;

/**
 * Enum defining all knife variants with their properties.
 * Used by GenericKnife to create knife items via factory pattern.
 *
 * Each tier has its own cutting speed and durability:
 * - Stone: slow, low capacity (emergency tool)
 * - Iron: medium speed, reliable capacity
 * - Golden: fast, high capacity (can cut through a padlock)
 *
 * Durability consumed per second = cuttingSpeed (1 durability = 1 resistance).
 */
public enum KnifeVariant {
    STONE("stone_knife", 100, 5), // 100 dura, 5 res/s → 20s, 100 total resistance
    IRON("iron_knife", 160, 8), // 160 dura, 8 res/s → 20s, 160 total resistance
    GOLDEN("golden_knife", 300, 12); // 300 dura, 12 res/s → 25s, 300 total resistance

    private final String registryName;
    private final int durability;
    private final int cuttingSpeed;

    KnifeVariant(String registryName, int durability, int cuttingSpeed) {
        this.registryName = registryName;
        this.durability = durability;
        this.cuttingSpeed = cuttingSpeed;
    }

    public String getRegistryName() {
        return registryName;
    }

    /**
     * Get the durability (max damage) of this knife.
     * Total resistance a knife can cut = durability (1:1 ratio with cuttingSpeed drain).
     *
     * @return Durability value
     */
    public int getDurability() {
        return durability;
    }

    /**
     * Get the cutting speed (resistance removed per second).
     * Also the durability consumed per second.
     *
     * @return Cutting speed in resistance/second
     */
    public int getCuttingSpeed() {
        return cuttingSpeed;
    }

    /**
     * Get max cutting time in seconds.
     *
     * @return Max cutting time (durability / cuttingSpeed)
     */
    public int getMaxCuttingTimeSeconds() {
        return durability / cuttingSpeed;
    }
}
