"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleManagementRemoteControlRequests = handleManagementRemoteControlRequests;
const remoteControlCommands_1 = require("./remoteControlCommands");
function handleManagementRemoteControlRequests(onCommand, dispatch, frontApplet) {
    onCommand(async (commandEvent) => {
        switch (commandEvent.command.type) {
            case remoteControlCommands_1.ManagementRemoteControlEnableRequest:
                await frontApplet.management.remoteControl.enable();
                await dispatch({
                    type: remoteControlCommands_1.ManagementRemoteControlEnableResult,
                    result: {},
                });
                break;
            case remoteControlCommands_1.ManagementRemoteControlDisableRequest:
                await frontApplet.management.remoteControl.disable();
                await dispatch({
                    type: remoteControlCommands_1.ManagementRemoteControlDisableResult,
                    result: {},
                });
                break;
            case remoteControlCommands_1.ManagementRemoteControlIsEnabledRequest:
                await dispatch({
                    type: remoteControlCommands_1.ManagementRemoteControlIsEnabledResult,
                    result: await frontApplet.management.remoteControl.isEnabled(),
                });
                break;
            case remoteControlCommands_1.ManagementRemoteControlLockRequest:
                await frontApplet.management.remoteControl.lock();
                await dispatch({
                    type: remoteControlCommands_1.ManagementRemoteControlLockResult,
                    result: {},
                });
                break;
            case remoteControlCommands_1.ManagementRemoteControlUnlockRequest:
                await frontApplet.management.remoteControl.unlock();
                await dispatch({
                    type: remoteControlCommands_1.ManagementRemoteControlUnlockResult,
                    result: {},
                });
                break;
            case remoteControlCommands_1.ManagementRemoteControlIsLockedRequest:
                await dispatch({
                    type: remoteControlCommands_1.ManagementRemoteControlIsLockedResult,
                    result: await frontApplet.management.remoteControl.isLocked(),
                });
                break;
            default:
        }
    });
}
//# sourceMappingURL=handleRemoteControlRequests.js.map