-- FIXME Luau: Since 2/3 action handlers don't actually use the `action`
-- parameter, Luau thinks it doesn't exist. So this type is used to make sure it
-- does. This might be fixed by recent changes to Rodux to add support for types

type ActionHandlers = { [string]: (State, any) -> State }

local ui = Rodux.createReducer(initialState, {
	[selfieModeOpened.name] = function(state: State)
		return Cryo.Dictionary.join(state, {
			isAppOpen = true,
		})
	end,

	[selfieModeClosed.name] = function(state: State)
		return Cryo.Dictionary.join(state, {
			isAppOpen = false,
		})
	end,

	[setHudButtonEnabled.name] = function(state: State, action: setHudButtonEnabled.Action)
		return Cryo.Dictionary.join(state, {
			isHudButtonEnabled = action.isEnabled,
		})
	end,
} :: ActionHandlers)

return ui
