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

import com.tiedup.remake.cells.CellDataV2;
import com.tiedup.remake.dialogue.EntityDialogueManager;
import com.tiedup.remake.entities.EntityKidnapper;
import com.tiedup.remake.entities.ai.kidnapper.KidnapperState;
import com.tiedup.remake.entities.kidnapper.components.ICaptiveHost;
import com.tiedup.remake.entities.kidnapper.components.KidnapperAggressionSystem;
import com.tiedup.remake.entities.kidnapper.components.KidnapperAlertManager;
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 implementation for KidnapperCaptiveManager callbacks.
 * Provides access to entity properties needed for captive management.
 */
public class CaptiveHost implements ICaptiveHost {

    private final EntityKidnapper entity;

    public CaptiveHost(EntityKidnapper entity) {
        this.entity = entity;
    }

    @Override
    public Level level() {
        return entity.level();
    }

    @Override
    public UUID getUUID() {
        return entity.getUUID();
    }

    @Override
    public Vec3 position() {
        return entity.position();
    }

    @Override
    public BlockPos blockPosition() {
        return entity.blockPosition();
    }

    @Override
    public String getNpcName() {
        return entity.getNpcName();
    }

    @Override
    public <T> void setEntityData(EntityDataAccessor<T> accessor, T value) {
        entity.getEntityData().set(accessor, value);
    }

    @Override
    public boolean isTiedUp() {
        return entity.isTiedUp();
    }

    @Override
    public KidnapperState getCurrentState() {
        return entity.getCurrentState();
    }

    @Override
    public void setCurrentState(KidnapperState state) {
        entity.setCurrentState(state);
    }

    @Override
    public void setGetOutState(boolean state) {
        entity.setGetOutState(state);
    }

    @Override
    public void talkToPlayersInRadius(
        EntityDialogueManager.DialogueCategory category,
        int radius
    ) {
        entity.talkToPlayersInRadius(category, radius);
    }

    @Override
    public KidnapperAggressionSystem getAggressionSystem() {
        return entity.getAggressionSystem();
    }

    @Override
    public KidnapperAlertManager getAlertManager() {
        return entity.getAlertManager();
    }

    @Override
    public void broadcastAlert(LivingEntity escapee) {
        entity.broadcastAlert(escapee);
    }

    @Override
    public boolean hasLineOfSight(LivingEntity entity) {
        return this.entity.hasLineOfSight(entity);
    }

    @Override
    public float distanceTo(LivingEntity entity) {
        return this.entity.distanceTo(entity);
    }

    @Override
    @Nullable
    public CellDataV2 findCellContainingPrisoner(UUID prisonerId) {
        return entity.findCellContainingPrisoner(prisonerId);
    }

    @Override
    public LivingEntity asLivingEntity() {
        return entity;
    }
}
