/*! phoscon-app 2025-08-29 */

import{serviceSend}from"./settings-gateway-machine.js";import{states,events}from"./settings-gateway-constants.js";import{restartOrShutdownGw}from"./settings-gateway-functions.js";const OPTION_SHUTDOWN="shutdown";export var shutdownGwViewHandlerFactory=view=>(ctx,activity)=>{let event=activity.type;if(event===states.SHUTDOWN_GW)view.show(),serviceSend(states.SHUTDOWN_GW_PAGE_1);else if(event===events.CLOSE_PRESSED)view.hide(),serviceSend(states.IDLE);else if(event===events.GW_NOT_REACHABLE)return void serviceSend(states.OFFLINE_HANDLER)};export var shutdownGwViewPage1HandlerFactory=view=>(ctx,activity)=>{let event=activity.type;event===states.SHUTDOWN_GW_PAGE_1?view.page1():event===events.NEXT_PRESSED?restartOrShutdownGw("shutdown"):event===events.SHUTDOWN_GW_SUCCESS?serviceSend(states.SHUTDOWN_GW_PAGE_2):event===events.SHUTDOWN_GW_FAIL&&serviceSend(states.SHUTDOWN_GW_PAGE_3)};export var shutdownGwViewPage2HandlerFactory=view=>(ctx,activity)=>{activity.type===states.SHUTDOWN_GW_PAGE_2&&view.page2()};export var shutdownGwViewPage3HandlerFactory=view=>(ctx,activity)=>{activity.type===states.SHUTDOWN_GW_PAGE_3&&view.page3()};