"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleManagementPeerRecoveryRequests = handleManagementPeerRecoveryRequests;
const peerRecoveryCommands_1 = require("./peerRecoveryCommands");
function handleManagementPeerRecoveryRequests(onCommand, dispatch, frontApplet) {
    onCommand(async (commandEvent) => {
        switch (commandEvent.command.type) {
            case peerRecoveryCommands_1.ManagementPeerRecoveryGetRequest:
                await dispatch({
                    type: peerRecoveryCommands_1.ManagementPeerRecoveryGetResult,
                    result: await frontApplet.management.peerRecovery.get(),
                });
                break;
            case peerRecoveryCommands_1.ManagementPeerRecoverySetRequest:
                await frontApplet.management.peerRecovery.set(commandEvent.command.configuration);
                await dispatch({
                    type: peerRecoveryCommands_1.ManagementPeerRecoverySetResult,
                    result: {},
                });
                break;
            default:
        }
    });
}
//# sourceMappingURL=handlePeerRecoveryRequests.js.map