import { get, writable } from "svelte/store";
import { fightConnector } from "./connections.svelte";

class TeamHoverService {
    public currentHover = $state<number | undefined>(undefined);
    private fightConnector = get(fightConnector);

    setHover(teamId: number): void {
        this.currentHover = teamId;
        this.fightConnector.addTeamConnection(teamId);
    }

    clearHover(): void {
        this.currentHover = undefined;
        this.fightConnector.clearConnections();
    }
}

export const teamHoverService = writable(new TeamHoverService());
