local ArenaSeasonRewardCell = class("ArenaSeasonRewardCell", BaseCell)

function ArenaSeasonRewardCell:init()
    local uiMap = self:getUIMap()

    self.cellGrading = uiMap["arena_reward_cell.arena_grading_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.ARENA_GRADING_CELL)
    self.rewards = {}
    for i = 1, 4 do
        self.rewards[i] = uiMap["arena_reward_cell.rewards.reward_cell_"..i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
    end
end

function ArenaSeasonRewardCell:refresh(id)
    local rewards = DataManager.ArenaData:getSeasonRewards(id)

    for idx, cell in pairs(self.rewards) do
        if rewards[idx] then
            cell:setVisible(true)
            cell:refreshByConfig(rewards[idx])
        else
            cell:setVisible(false)
        end
        
    end
    self.cellGrading:refresh(id)
end

return ArenaSeasonRewardCell