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

import com.tiedup.remake.cells.CellDataV2;
import com.tiedup.remake.entities.EntityKidnapper;
import com.tiedup.remake.entities.ai.kidnapper.KidnapperState;
import com.tiedup.remake.entities.kidnapper.components.IAIHost;
import com.tiedup.remake.state.IBondageState;
import java.util.List;
import java.util.UUID;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.goal.GoalSelector;
import net.minecraft.world.entity.ai.navigation.PathNavigation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;

/**
 * Host implementation for KidnapperAIManager callbacks.
 * Provides access to entity properties and components needed for AI goal registration.
 */
public class AIHost implements IAIHost {

    private final EntityKidnapper entity;

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

    // NAVIGATION & BASIC

    @Override
    public PathNavigation getNavigation() {
        return entity.getNavigation();
    }

    @Override
    public GoalSelector getGoalSelector() {
        return entity.goalSelector;
    }

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

    // STATE MANAGEMENT

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

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

    // TARGET MANAGEMENT

    @Override
    @Nullable
    public LivingEntity getTarget() {
        return entity.getTarget();
    }

    @Override
    public void setTarget(@Nullable LivingEntity target) {
        entity.setTarget(target);
    }

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

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

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

    @Override
    @Nullable
    public LivingEntity getClosestSuitableTarget(int radius) {
        return entity.getClosestSuitableTarget(radius);
    }

    // CAPTIVE MANAGEMENT

    @Override
    @Nullable
    public IBondageState getCaptive() {
        // C6-V2: EntityKidnapper.getCaptive() returns IRestrainable which IS-A IBondageState
        return entity.getCaptive();
    }

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

    // AGGRESSION SYSTEM

    @Override
    @Nullable
    public LivingEntity getLastAttacker() {
        return entity.getLastAttacker();
    }

    @Override
    @Nullable
    public LivingEntity getEscapedTarget() {
        return entity.getEscapedTarget();
    }

    // ALERT SYSTEM

    @Override
    @Nullable
    public LivingEntity getAlertTarget() {
        return entity.getAlertTarget();
    }

    @Override
    public void setAlertTarget(@Nullable LivingEntity target) {
        entity.setAlertTarget(target);
    }

    // CAMP SYSTEM

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

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

    // CELL SYSTEM

    @Override
    public List<CellDataV2> getNearbyCellsWithPrisoners() {
        return entity.getNearbyCellsWithPrisoners();
    }

    @Override
    public List<BlockPos> getNearbyPatrolMarkers(int radius) {
        return entity.getNearbyPatrolMarkers(radius);
    }

    // SALE & JOB SYSTEM

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

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

    // COLLAR CONFIG

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

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

    // CAPTURE EQUIPMENT

    @Override
    public void setUpHeldItems() {
        entity.setUpHeldItems();
    }

    @Override
    public ItemStack getBindItem() {
        return entity.getBindItem();
    }

    @Override
    public ItemStack getGagItem() {
        return entity.getGagItem();
    }

    // STATE FLAGS

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

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