/*
 *  Copyright 2025-2026 R3944Realms
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package top.r3944realms.eroticdungeongame.util;

import net.minecraft.client.multiplayer.PlayerInfo;
import net.minecraft.network.protocol.game.*;

import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.UUID;

public interface IEDGClientPacketListener {
    Map<UUID, PlayerInfo> getNPCPlayerInfoMap();

    Set<PlayerInfo> getListedNPCPlayers();

    default Collection<PlayerInfo> getOnlineNPCPlayers() {
        return getNPCPlayerInfoMap().values();
    }

    default Collection<UUID> getOnlineNPCPlayerIds() {
        return getNPCPlayerInfoMap().keySet();
    }

    @Nullable
    default PlayerInfo getNPCPlayerInfo(UUID uniqueId) {
        return getNPCPlayerInfoMap().get(uniqueId);
    }

    @Nullable
    default PlayerInfo getNPCPlayerInfo(String name) {
        for(PlayerInfo playerinfo : getNPCPlayerInfoMap().values()) {
            if (playerinfo.getProfile().getName().equals(name)) {
                return playerinfo;
            }
        }
        return null;
    }

    void edg$createNPCPlayer(ClientboundAddPlayerPacket packet, PlayerInfo playerInfo);

//    void edg$createEntity(ClientboundAddEntityPacket packet);

    void edg$setEntityMotion(ClientboundSetEntityMotionPacket packet);

    void edg$setEntityData(ClientboundSetEntityDataPacket packet);

    void edg$updateAttributes(ClientboundUpdateAttributesPacket packet);

    void edg$setEquipment(ClientboundSetEquipmentPacket packet);

    void edg$setPassengers(ClientboundSetPassengersPacket packet);

    void edg$setEntityLink(ClientboundSetEntityLinkPacket packet);

    void edg$rotateHead(ClientboundRotateHeadPacket packet);

    void edg$moveEntity(ClientboundMoveEntityPacket movePacket);

    void edg$teleportEntity(ClientboundTeleportEntityPacket teleportPacket);
}
