local this = class("homeTechnologyTreeTpl")

function this:init(config)
  self.data = config
  self:initDataByIndex()
end

function this:getTplById(id)
  return self.data[id]
end

function this:getName(tpl)
  return L_Config:provider(tpl.name)
end

function this:getIcon(tpl)
  return tpl.icon
end

function this:getCategory(tpl)
  return tpl.category
end

function this:getNodeType(tpl)
  return tpl.nodeType
end

function this:getTabName(tpl)
  return tpl.tabName
end

function this:getTier(tpl)
  return tpl.tier
end

function this:getMaxLevel(tpl)
  return tpl.maxLevel
end

function this:getPosttechnologyTypeId(tpl)
  return tpl.posttechnologyTypeId
end

function this:getType(tpl)
  return tpl.type
end

function this:getId(tpl)
  return tpl.id
end

function this:getLocation(tpl)
  return tpl.location
end

function this:initDataByIndex()
  self.allTreeCount = {}
  for i, v in pairs(self.data) do
    local type = v.type
    if self.allTreeCount[type] == nil then
      self.allTreeCount[type] = 0
    end
    self.allTreeCount[type] = self.allTreeCount[type] + v.maxLevel
  end
end

function this:getTypeMaxCnt(type)
  return self.allTreeCount[type]
end

function this:getNodeTypeIcon(tpl)
  return tpl.nodeTypeIcon
end

function this:getMarkIcon(tpl)
  return tpl.markIcon
end

return this
