package com.openosrs.client.api.types;

public class OtherPlayer {
    private final int index;
    private final String username;
    private final Position position;
    private final int combatLevel;
    private final int animationId;
    private final String overheadText;
    private final boolean inCombat;

    public OtherPlayer(int index, String username, Position position,
                      int combatLevel, int animationId, String overheadText, boolean inCombat) {
        this.index = index;
        this.username = username;
        this.position = position;
        this.combatLevel = combatLevel;
        this.animationId = animationId;
        this.overheadText = overheadText;
        this.inCombat = inCombat;
    }

    public int getIndex() { return index; }
    public String getUsername() { return username; }
    public Position getPosition() { return position; }
    public int getCombatLevel() { return combatLevel; }
    public int getAnimationId() { return animationId; }
    public String getOverheadText() { return overheadText; }
    public boolean isInCombat() { return inCombat; }

    public double distanceToPlayer(Position playerPos) {
        return position.distanceTo(playerPos);
    }

    @Override
    public String toString() {
        return String.format("Player[%d] %s (cb:%d) at %s", index, username, combatLevel, position);
    }
}
