"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleManagementSecurityRequests = handleManagementSecurityRequests;
const securityCommands_1 = require("./securityCommands");
function handleManagementSecurityRequests(onCommand, dispatch, frontApplet) {
    onCommand(async (commandEvent) => {
        switch (commandEvent.command.type) {
            case securityCommands_1.ManagementSecurityGetPinCodeRequest:
                await dispatch({
                    type: securityCommands_1.ManagementSecurityGetPinCodeResult,
                    pinCode: await frontApplet.management.security.getPinCode(),
                });
                break;
            case securityCommands_1.ManagementSecuritySetPinCodeRequest:
                await frontApplet.management.security.setPinCode(commandEvent.command.pinCode);
                await dispatch({
                    type: securityCommands_1.ManagementSecuritySetPinCodeResult,
                    result: {},
                });
                break;
            case securityCommands_1.ManagementSecurityGenerateRandomPinCodeRequest:
                await frontApplet.management.security.generateRandomPinCode();
                await dispatch({
                    type: securityCommands_1.ManagementSecurityGenerateRandomPinCodeResult,
                    result: {},
                });
                break;
            default:
        }
    });
}
//# sourceMappingURL=handleSecurityCommands.js.map