import { createSlice, PayloadAction } from '@reduxjs/toolkit'; export const SystemMode = { Unkonwn: 'Unknown', Emergency: 'Emergency', Normal: 'Normal', } as const; export type SystemMode = (typeof SystemMode)[keyof typeof SystemMode]; interface SystemModeState { mode: SystemMode; } const initialState: SystemModeState = { mode: SystemMode.Unkonwn, }; const systemModeSlice = createSlice({ name: 'systemMode', initialState, reducers: { setSystemMode: (state, action: PayloadAction) => { state.mode = action.payload; }, }, }); export const { setSystemMode } = systemModeSlice.actions; export default systemModeSlice.reducer;