import { Accuracy } from "expo-location" import { useAppDispatch, useAppSelector } from "./useStore" import { GamePayload, PenaltyPayload, setLocationAccuracy, setPlayerId, updateActiveChallengeId, updateGameState, updateMoney, updatePenalty } from "@/utils/features/game/gameSlice" export const useGame = () => useAppSelector((state) => state.game) export const useSettings = () => useAppSelector((state) => state.game.settings) export const useSetPlayerId = () => { const dispath = useAppDispatch() return (playerId: number) => dispath(setPlayerId(playerId)) } export const useUpdateMoney = () => { const dispatch = useAppDispatch() return (money: number) => dispatch(updateMoney(money)) } export const useUpdateActiveChallengeId = () => { const dispatch = useAppDispatch() return (challengeActionId: number) => dispatch(updateActiveChallengeId(challengeActionId)) } export const useUpdateGameState = () => { const dispatch = useAppDispatch() return (game: GamePayload) => dispatch(updateGameState(game)) } export const useUpdatePenalty = () => { const dispatch = useAppDispatch() return (penalty: PenaltyPayload) => dispatch(updatePenalty(penalty)) } export const useSetLocationAccuracy = () => { const dispatch = useAppDispatch() return (accuracy: Accuracy | null) => dispatch(setLocationAccuracy(accuracy)) }