package com.tiedup.remake.entities.kidnapper.components;

import com.tiedup.remake.entities.ai.kidnapper.KidnapperState;
import java.util.UUID;
import net.minecraft.core.BlockPos;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.Nullable;

/**
 * Host interface for KidnapperCaptiveManager callbacks.
 * Provides access to entity properties needed for captive management.
 */
public interface ICaptiveHost {
    /**
     * Get the entity's level/world.
     */
    Level level();

    /**
     * Get the entity's UUID.
     */
    UUID getUUID();

    /**
     * Get the entity's position.
     */
    Vec3 position();

    /**
     * Get the entity's block position.
     */
    BlockPos blockPosition();

    /**
     * Get the kidnapper's name for logging.
     */
    String getNpcName();

    /**
     * Set entity data value.
     */
    <T> void setEntityData(EntityDataAccessor<T> accessor, T value);

    /**
     * Check if this kidnapper is tied up.
     */
    boolean isTiedUp();

    /**
     * Get the current AI state.
     */
    KidnapperState getCurrentState();

    /**
     * Set the current AI state.
     */
    void setCurrentState(KidnapperState state);

    /**
     * Set the "get out" / flee state.
     */
    void setGetOutState(boolean state);

    /**
     * Trigger dialogue with nearby players.
     */
    void talkToPlayersInRadius(
        com.tiedup.remake.dialogue.EntityDialogueManager.DialogueCategory category,
        int radius
    );

    /**
     * Get the aggression system for escape tracking.
     */
    KidnapperAggressionSystem getAggressionSystem();

    /**
     * Get the alert manager for broadcasting alerts.
     */
    KidnapperAlertManager getAlertManager();

    /**
     * Broadcast alert about escaped captive.
     */
    void broadcastAlert(LivingEntity escapee);

    /**
     * Check if has line of sight to entity.
     */
    boolean hasLineOfSight(LivingEntity entity);

    /**
     * Get distance to entity.
     */
    float distanceTo(LivingEntity entity);

    /**
     * Find cell containing prisoner.
     */
    @Nullable
    com.tiedup.remake.cells.CellDataV2 findCellContainingPrisoner(
        UUID prisonerId
    );

    /**
     * Get entity as LivingEntity.
     */
    LivingEntity asLivingEntity();
}
