local this = {}

function this:init()
  this.super.init(self)
  self.data = {
    allItem = {},
    setHasInitSync = false
  }
end

function this:getItem(id, isCreate)
  local item = self.data.allItem[id]
  if item == nil and isCreate then
    item = require("ui.store.playerDisplay.playerDressItem").new()
    self.data.allItem[id] = item
  end
  return item
end

function this:getItemListByType(dressType)
  local list = {}
  for i, v in pairs(self.data.allItem) do
    if v.tpl.type == dressType then
      table.insert(list, v)
    end
  end
  return list
end

function this:fillEmptyCustom()
  for i, v in pairs(self._playerCardDressTpl.data) do
    local item = v.type ~= L_Const.playerDressType.hero or v.customize ~= 1 or self:hasItem(v.id) or self:getItem(v.id, true)
  end
end

function this:getCurStandeeInfo()
  local baseInfo = L_PlayerStore:getPlayerBaseInfo()
  return baseInfo.stand_plates
end

function this:getCurbackground()
  local baseInfo = L_PlayerStore:getPlayerBaseInfo()
  return baseInfo.stand_plates.backboard
end

function this:getCurbase()
  local baseInfo = L_PlayerStore:getPlayerBaseInfo()
  return baseInfo.stand_plates.baseboard
end

function this:getcurHero()
  local baseInfo = L_PlayerStore:getPlayerBaseInfo()
  return baseInfo.stand_plates.role
end

function this:getcurPet()
  local baseInfo = L_PlayerStore:getPlayerBaseInfo()
  return baseInfo.stand_plates.pet_accessory
end

function this:clear()
  self.data.allItem = {}
  self.data.setHasInitSync = false
end

return this
