"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleManagementTimeCommands = handleManagementTimeCommands;
const timeCommands_1 = require("./timeCommands");
function handleManagementTimeCommands(onCommand, dispatch, frontApplet) {
    onCommand(async (commandEvent) => {
        switch (commandEvent.command.type) {
            case timeCommands_1.ManagementTimeGetTimeRequest:
                await dispatch({
                    type: timeCommands_1.ManagementTimeGetTimeResult,
                    result: await frontApplet.management.time.get(),
                });
                break;
            case timeCommands_1.ManagementTimeSetManualRequest:
                await dispatch({
                    type: timeCommands_1.ManagementTimeSetManualResult,
                    result: {},
                });
                await frontApplet.management.time.setManual(commandEvent.command.dateTime, commandEvent.command.timezone);
                break;
            case timeCommands_1.ManagementTimeSetNTPRequest:
                await dispatch({
                    type: timeCommands_1.ManagementTimeSetNTPResult,
                    result: {},
                });
                await frontApplet.management.time.setNTP(commandEvent.command.ntpServer, commandEvent.command.timezone);
                break;
            default:
        }
    });
}
//# sourceMappingURL=handleTimeCommands.js.map