local HeroPropertyData = BaseClass("HeroPropertyData")
local __init = function(self, propertyData)
  if propertyData == nil then
    self.propertyData = {}
  else
    self.propertyData = propertyData
  end
end
local __delete = function(self)
  self.propertyData = nil
end
local GetProperty = function(self, propertyType)
  if self.propertyData == nil or not self.propertyData[propertyType] then
    return 0
  end
  return self.propertyData[propertyType]
end
local GetAllProperty = function(self)
  return DeepCopy(self.propertyData)
end

function HeroPropertyData:GetAllPropertyReadOnly()
  return self.propertyData
end

local SetProperty = function(self, propertyType, value)
  if self.propertyData[propertyType] ~= value then
    self.isDirty = true
  end
  self.propertyData[propertyType] = value
end
local Clear = function(self)
  self.propertyData = {}
  self.isDirty = false
end
local ClearDirtyState = function(self)
  self.isDirty = false
end
local WalkAllProperties = function(self, func)
  if self.propertyData == nil then
    return
  end
  for k, v in pairs(self.propertyData) do
    func(k, v)
  end
end
HeroPropertyData.__init = __init
HeroPropertyData.__delete = __delete
HeroPropertyData.GetProperty = GetProperty
HeroPropertyData.GetAllProperty = GetAllProperty
HeroPropertyData.SetProperty = SetProperty
HeroPropertyData.Clear = Clear
HeroPropertyData.ClearDirtyState = ClearDirtyState
HeroPropertyData.WalkAllProperties = WalkAllProperties
return HeroPropertyData
