local o=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local T=script.Parent.Parent local m=o:WaitForChild("\108\105\098")local M=require(m:WaitForChild("\082\111\100\117\120"))local N=require(m:WaitForChild("\083\105\103\110\097\108"))local y=require(m:WaitForChild("\080\105\122\122\097\065\108\112\097\099\097"))local k=require(m:WaitForChild("\080\114\111\109\105\115\101"))local f=require(T:WaitForChild("\099\108\105\101\110\116\082\101\100\117\099\101\114"))local P=y.GameModule:extend("\083\116\111\114\101\067\111\110\116\097\105\110\101\114")function P.create(o)o.storeCreated=N.new()end function P.getStore(o)return k.async(function(T,m)if not o.store then o.storeCreated:wait()end T(o.store)end)end function P.createStore(T,o)local m=M.Store.new(f,o,{M.thunkMiddleware})T.store=m T.storeCreated:fire()T.logger:log("\067\108\105\101\110\116 \115\116\111\114\101 \105\110\105\116\105\097\108\105\122\101\100\046")end function P.preInit(o)o.logger=(o.core:getModule("\076\111\103\103\101\114")):createLogger(o)end function P.init(o) end function P.postInit(o) end return P
-- contains the games store and handles action replication

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local src = script.Parent.Parent
local lib = ReplicatedStorage:WaitForChild("lib")

local Rodux = require(lib:WaitForChild("Rodux"))
local Signal = require(lib:WaitForChild("Signal"))
local PizzaAlpaca = require(lib:WaitForChild("PizzaAlpaca"))
local Promise = require(lib:WaitForChild("Promise"))

local reducer = require(src:WaitForChild("clientReducer"))

local StoreContainer = PizzaAlpaca.GameModule:extend("StoreContainer")

function StoreContainer:create()
    self.storeCreated = Signal.new()
end

function StoreContainer:getStore()
    return Promise.async(function(resolve, reject)
        if not self.store then self.storeCreated:wait() end
        resolve(self.store)
    end)
end

function StoreContainer:createStore(initialState)
    local store = Rodux.Store.new(reducer,initialState, {
		Rodux.thunkMiddleware,
		--Rodux.loggerMiddleware,
    })

    self.store = store

    self.storeCreated:fire()
    self.logger:log("Client store initialized.")
end

function StoreContainer:preInit()
    self.logger = self.core:getModule("Logger"):createLogger(self)
end

function StoreContainer:init()
end

function StoreContainer:postInit()
end

return StoreContainer