local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
local SideBarHeroFundCell = class("SideBarHeroFundCell", SideBarBaseCellComp)

function SideBarHeroFundCell:getModuleKey()
    return ModuleManager.MODULE_KEY.SEVEN_DAY
end

function SideBarHeroFundCell:getHasPurchase()
    return true
end

function SideBarHeroFundCell:getIsOpen()
    return DataManager.HeroFundData:getIsOpen()
end

function SideBarHeroFundCell:getSpineName()
    return "ui_main_herofund"
end

function SideBarHeroFundCell:onClick()
    ModuleManager.HeroFundManager:showMainUI()
end

function SideBarHeroFundCell:getIsShowRedPoint()
    return DataManager.HeroFundData:getHaveReward()
end

function SideBarHeroFundCell:onRefresh()
    self.timeBg:setVisible(true)
    self:_refreshTime()
end

function SideBarHeroFundCell:updateTime()
    if self:getIsOpen() then
        self:_refreshTime()
    else
        self:closeBtn()
    end
end

function SideBarHeroFundCell:_refreshTime()
    local remainTime = DataManager.HeroFundData:getRemainTime()
    if remainTime >= 0 then
        self.timeTx:setText(GFunc.getTimeStr(remainTime))
    else
        self.timeTx:setText("00:00:00")
    end
end

return SideBarHeroFundCell