package com.tiedup.remake.state.components;

import com.tiedup.remake.core.TiedUpMod;
import com.tiedup.remake.state.IRestrainableEntity;
import com.tiedup.remake.state.hosts.IPlayerBindStateHost;
import com.tiedup.remake.util.RestraintEffectUtils;
import com.tiedup.remake.v2.BodyRegionV2;

/**
 * Component responsible for special player interactions.
 * v2.5: Knife cut target for accessory cutting
 *
 * Single Responsibility: Special action management
 * Complexity: MEDIUM (external dependencies)
 * Risk: LOW (well-defined interactions)
 */
public class PlayerSpecialActions {

    private final IPlayerBindStateHost host;

    // v2.5: Knife cut target region for accessory cutting (migrated to V2)
    private BodyRegionV2 knifeCutRegion = null;

    public PlayerSpecialActions(IPlayerBindStateHost host) {
        this.host = host;
    }

    // ========== Knife Cut Target ==========

    /**
     * Set the body region target for knife cutting.
     * Used when player selects "Cut" from StruggleChoiceScreen.
     *
     * @param region The body region to cut (NECK, MOUTH, etc.)
     */
    public void setKnifeCutTarget(BodyRegionV2 region) {
        this.knifeCutRegion = region;
    }

    /**
     * Get the current knife cut target region.
     *
     * @return The target region, or null if none
     */
    public BodyRegionV2 getKnifeCutTarget() {
        return knifeCutRegion;
    }

    /**
     * Clear the knife cut target.
     */
    public void clearKnifeCutTarget() {
        this.knifeCutRegion = null;
    }

    // ========== Special Interactions ==========

    /**
     * Apply chloroform effects to the player.
     *
     * @param duration Duration in seconds
     */
    public void applyChloroform(int duration) {
        if (host.getPlayer() == null) return;
        RestraintEffectUtils.applyChloroformEffects(host.getPlayer(), duration);
    }

    /**
     * Updated to use IRestrainable parameter (was PlayerBindState)
     *
     * @param taker The entity taking the item
     * @param slotIndex The slot index to take from
     */
    public void takeBondageItemBy(IRestrainableEntity taker, int slotIndex) {
        TiedUpMod.LOGGER.debug(
            "[PlayerSpecialActions] {} taking bondage item from {} (slot {})",
            taker.getKidnappedName(),
            host.getPlayer().getName().getString(),
            slotIndex
        );
    }
}
