local SummonOddsCell = class("SummonOddsCell", BaseCell)

function SummonOddsCell:init()
	local uiMap = self:getUIMap()
	self.oddImg = uiMap["cell.odd_img"]
	self.descTx = uiMap["cell.odd_img.desc_tx"]
	self.oddsImgTx = uiMap["cell.odd_img.odds_tx"]
	self.icon = uiMap["cell.odd_img.icon"]
	self.oddDescBg = uiMap["cell.odd_desc_bg"]
	self.oddsDescTx = uiMap["cell.odd_desc_bg.odds_tx"]

	self.forceIcons = {
		"battle_gamble_icon_5",
		"battle_gamble_icon_1",
		"battle_gamble_icon_2",
		"battle_gamble_icon_3",
		"battle_gamble_icon_6",
	}
end

function SummonOddsCell:refresh(info)
	if info.idx then
		self.oddImg:setVisible(false)
		self.oddDescBg:setVisible(true)
		if info.idx == 1 then
			self.oddsDescTx:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_FORCE_8))
		else
			self.oddsDescTx:setText(I18N:getGlobalText(I18N.GlobalConst.SUMMON_FORCE_9))
		end
	else
		self.oddImg:setVisible(true)
		self.oddDescBg:setVisible(false)
		if info.reward_type == 0 then
			-- self.icon:setSprite(GFunc.getForceRes(info.reward_id))
			self.icon:setSprite(GConst.ATLAS_PATH.UI_BATTLE, self.forceIcons[info.reward_id])
			self.descTx:setText(I18N:getGlobalText(I18N.GlobalConst["FORCE_QLT_DESC_" .. info.reward_id]))
		else
			self.icon:setSprite(GFunc.getIconRes(info.reward_id))
			self.descTx:setText(I18N:getText("item", info.reward_id, "name") .. "x" .. (info.reward_num or 0))
		end
		self.oddsImgTx:setText(((info.reward_odds or 0) / 100) .. "%")
	end
end

return SummonOddsCell