local this = class("homeScienceStore", G_BaseStore)
local homeScienceTypeTpl = L_GameTpl.getHomeScienceTypeTpl()
local homeScienceTpl = L_GameTpl.getHomeScienceTpl()
this.event = {refresh = "refresh"}
this:importPartialClass(require(L_R.store .. "homeScience.homeScienceState"))
this:importPartialClass(require(L_R.store .. "homeScience.homeScienceAction"))

function this:ctor()
  this.super.ctor(self)
end

function this:refreshScienceLevelRecord()
  local temp = {}
  self.data.scienceLevelRecord = temp
  local scienceTypeTplArray = homeScienceTypeTpl:getArray()
  for k, v in pairs(scienceTypeTplArray) do
    temp[v.id] = 0
  end
  local homeScienceTplArray = homeScienceTpl:getArray()
  for k, v in pairs(homeScienceTplArray) do
    local level = homeScienceTpl:getLevel(v)
    local type = homeScienceTpl:getScienceType(v)
    local state = L_HomeScienceStore:getNodeInfo(homeScienceTpl:getId(v)).state
    if level > temp[type] and state == L_Const.homeScienceNodeState.complete then
      temp[type] = level
    end
  end
end

return this
