import * as ui from "@minecraft/server-ui";
import { cancelRec } from "./cancel-recording";
import { doSave } from "../functions/replayControls/save-replay-recording";
import { doPause } from "../functions/replayControls/pause-replay-playback";
export function ReplayCraft2B(player) {
    //if SharedVariables.replayStateMachine.state = recPending
    const replayForm = new ui.ActionFormData()
        .title("rc1.recordingmenu.title")
        .button("rc1.button.save.recording") //0
        .button("rc1.button.pause.recording") //1
        .button("rc1.button.cancel.recording") //2
        .body("rc1.body.2b");
    replayForm.show(player).then((result) => {
        if (result.canceled)
            return;
        const actions = {
            0: () => doSave(player),
            1: () => doPause(player),
            2: () => cancelRec(player),
        };
        const selectedAction = actions[result.selection];
        if (selectedAction) {
            selectedAction();
        }
    });
}
