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

function SideBarTournWaveCell:getModuleKey()
    return ModuleManager.MODULE_KEY.ACTIVITY
end

function SideBarTournWaveCell:getIsOpen()
    return DataManager.TournWaveData:isOpen() and DataManager.TournWaveData:isActiveTime()
end

function SideBarTournWaveCell:getSpineName()
    return "ui_act_tournwave_main_btn"
end

function SideBarTournWaveCell:onClick()
    ModuleManager.TournWaveManager:showActMainUI()
end

function SideBarTournWaveCell:getIsShowRedPoint()
    return DataManager.TournWaveData:hasEntryRedPoint()
end

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

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

function SideBarTournWaveCell:_refreshTime()
    local remainTime = DataManager.TournWaveData:getEndRemainTime()
    if remainTime >= 0 then
        self.timeTx:setText(GFunc.getTimeStr(remainTime))
    else
        self.timeTx:setText("00:00:00")
    end
end

return SideBarTournWaveCell