local DataRelay = {}

DataRelay._cacheTable = {}

DataRelay.KEY_TYPE = {
    -- CACHE
    ["SOME_CACHE_KEY"]                  = "SOME_CACHE_KEY",
    ["HEART_BEAT"]                      = "HEART_BEAT",

    -- ScreenContent
    ["CURRENT_SCREEN_CONTENT_INFO"]     = "CURRENT_SCREEN_CONTENT_INFO",

    -- SAVE
    ["SOME_SAVE_KEY"]                   = "SOME_SAVE_KEY",
}

function DataRelay:SetCache(key, value)
    self._cacheTable[key] = value
end

function DataRelay:GetCache(key, defaultValue)
    local result = self._cacheTable[key]
    if nil == result then return defaultValue end
    return result
end

function DataRelay:SaveString(key, value)
    CS.UnityEngine.PlayerPrefs.SetString(key, value)
end

function DataRelay:LoadString(key, defaultValue)
    local result = CS.UnityEngine.PlayerPrefs.GetString(key, defaultValue)
    return result
end

function DataRelay:SetInt(key, value)
    CS.UnityEngine.PlayerPrefs.SetInt(key, value)
end

function DataRelay:GetInt(key, defaultValue)
    local result = CS.UnityEngine.PlayerPrefs.GetInt(key, defaultValue)
    return result
end

function DataRelay:SetFloat(key, value)
    CS.UnityEngine.PlayerPrefs.SetFloat(key, value)
end

function DataRelay:GetFloat(key, defaultValue)
    local result = CS.UnityEngine.PlayerPrefs.GetFloat(key, defaultValue)
    return result
end

return DataRelay