local module = class("cellPetNewSkill", G_UIModuleBase)
local SKILLBORDERICON = {
  [0] = "#828282",
  [1] = "#fb7675",
  [2] = "#fd9c47",
  [3] = "#e5b933",
  [4] = "#5dca95",
  [5] = "#47cdc9",
  [6] = "#16d0ff",
  [7] = "#708bff",
  [8] = "#e2ca2a",
  [9] = "#9a76f5"
}

function module:ctor(...)
  module.super.ctor(self, ...)
end

function module.bind()
  return {
    borderImgColor = C_Color(0.5, 0.5, 0.5, 1),
    skillLv = "",
    skillName = "",
    itemIcon = ""
  }
end

function module.methods()
  return {
    onClick_Choose = function(self)
      self:emit("onClick_Choose", self.bind.index, self.bind)
    end,
    onClick_Down = function(self)
      self:emit("onClick_Down", self.bind.index, self.bind)
    end,
    onClick_Up = function(self)
      self:emit("onClick_Up", self.bind.index, self.bind)
    end
  }
end

function module:open()
  self:refreshInfo()
end

function module:refresh()
end

function module:refreshInfo()
  if self.bind.starLv and self.bind.starLv ~= 0 then
    self.bind.itemIcon = "Skill/tex_icon_skill_playgirl01"
  end
  if self.bind.skillElement ~= nil then
    self.bind.borderImgColor = C_LuaUtility.ParseHtmlStringColor(SKILLBORDERICON[self.bind.skillElement[1]])
  end
end

function module:getPosition()
  return self.bindComponents.skillItemTrans.position
end

function module:close()
end

return module
