local this = class("cellCostItemSquare", G_UIModuleBase)

function this.bind()
  return {
    bgActive = false,
    addBtnActive = false,
    cellIcon = L_Const.ModuleInfo.CellIconSquare,
    cellIconActive = false
  }
end

function this.methods()
  return {
    onClick_add = function(self)
      if self.bind.onAddClick then
        self.bind.onAddClick()
      end
    end
  }
end

function this:refresh()
  if self.bind.cellIconActive then
    if self.bind.itemType == L_Const.resType.commonItem then
      self.modules.cellIcon:setGeneralContent(self.bind.itemType, self.bind.itemId, self.bind.params)
    end
    if self.bind.itemType == L_Const.resType.spiritron then
      local spiritronData = L_SpiritronStore:getSpiritronItem(self.bind.guid)
      self.modules.cellIcon:setGeneralContent(L_Const.resType.spiritron, spiritronData.spiritronId, self.bind.params, spiritronData)
    end
  end
end

function this:setSelectNum(num)
  self.bind.selectNum = num
  self.modules.cellIcon:setSelectNum(self.bind.selectNum)
end

return this
