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

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

function SideBarFullMoonCell:getIsOpen()
    return DataManager.FullMoonData:isOpen() and DataManager.FullMoonData:isOpenTime()
end

function SideBarFullMoonCell:getSpineName()
    return "ui_main_btn_act_fullmoon"
end

function SideBarFullMoonCell:onClick()
    ModuleManager.FullMoonManager:showActMainUI()
end

function SideBarFullMoonCell:getIsShowRedPoint()
    return DataManager.FullMoonData:hasEntryRedPoint()
end

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

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

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

return SideBarFullMoonCell