local this = class("currencyTpl")

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

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

function this:getDesc(tpl)
  return L_Config:provider(tpl.desc)
end

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

function this:getQuality(tpl)
  return tpl.quality
end

function this:getIconSmall(tpl)
  local icon = L_Config:getPathByHash(tpl.iconSmall)
  return icon
end

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

function this:getIcon(tpl)
  local icon = L_Config:getPathByHash(tpl.icon)
  return icon
end

function this:getWayList(tpl)
  local res = {}
  for i = 1, 3 do
    local systemIdKey = string.format("way%d", i)
    local descKey = string.format("way%ddesc", i)
    if not string.isEmpty(L_Config:provider(tpl[descKey])) then
      table.insert(res, {
        id = tpl[systemIdKey],
        desc = L_Config:provider(tpl[descKey])
      })
    end
  end
  return res
end

function this:getSpecialDesc(tpl)
  return L_Config:provider(tpl.specialDesc)
end

return this
