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

function SideBarArenaGiftCell:getModuleKey()
    return ModuleManager.MODULE_KEY.ARENA_GIFT
end

function SideBarArenaGiftCell:getHasPurchase()
    return true
end

function SideBarArenaGiftCell:getIsOpen()
    return DataManager.ArenaData:getGiftId()
end

function SideBarArenaGiftCell:getSpineName()
    return "ui_main_gift_arena"
end

function SideBarArenaGiftCell:onClick()
    ModuleManager.ArenaManager:showGiftPopUI(BIReport.PAY_UI_SHOW_TYPE.CLICK_SHOW)
end

function SideBarArenaGiftCell:getIsShowRedPoint()
    return false
end

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

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

function SideBarArenaGiftCell:_refreshTime()
    local remainTime = DataManager.ArenaData:getGiftRemainTime()
    if remainTime >= 0 then
        self.timeTx:setText(GFunc.getTimeStr(remainTime))
    else
        self.timeTx:setText("00:00:00")
    end
end

return SideBarArenaGiftCell