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

function SideBarBossRushCell:getModuleKey()
    return nil
end

function SideBarBossRushCell:getHasPurchase()
    return true
end

function SideBarBossRushCell:getIsOpen()
    return DataManager.ActBossRushData:getIsOpen()
end

function SideBarBossRushCell:getSpineName()
    return "ui_act_bossrush_mainbtn"
end

function SideBarBossRushCell:onClick()
    ModuleManager.ActBossRushManager:showMainUI()
end

function SideBarBossRushCell:getIsShowRedPoint()
    return DataManager.ActBossRushData:getRp()
end

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

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

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

return SideBarBossRushCell