import { sendToWorkadventure } from "../IframeApiContribution";
import type { ClosePopupEvent } from "../../Events/ClosePopupEvent";

export class Popup {
    inputValue: string;

    constructor(private id: number) {
        this.inputValue = "";
    }

    /**
     * Closes the popup
     */
    public close(): void {
        sendToWorkadventure({
            type: "closePopup",
            data: {
                popupId: this.id,
                inputValue: this.inputValue,
            } as ClosePopupEvent,
        });
    }
}
