local this = {}
local dataCls = {}
local homeHouseRoomInfo = class("homeHouseRoomInfo")
dataCls.homeHouseRoomInfo = homeHouseRoomInfo

function homeHouseRoomInfo:ctor(id)
  self.id = id
  self.resident = 0
  self.enterTime = 0
end

function homeHouseRoomInfo:populate(room)
  self.resident = room.people_id
  self.enterTime = room.enter_time
  return self
end

local homeHouseInfo = class("homeHouseInfo")
dataCls.homeHouseInfo = homeHouseInfo

function homeHouseInfo:ctor(guid)
  self.guid = guid
  self.roomInfo = {}
end

function homeHouseInfo:populate(data)
  self.guid = data.guid
  for _, room in ipairs(data.resident_room_info or {}) do
    local id = room.id
    self.roomInfo[id] = (self.roomInfo[id] or homeHouseRoomInfo.new(id)):populate(room)
  end
  return self
end

local homeResidentEventInfo = class("homeResidentEventInfo")
dataCls.homeResidentEventInfo = homeResidentEventInfo

function homeResidentEventInfo:ctor()
  self.id = 0
  self.param = 0
  self.time = 0
end

function homeResidentEventInfo:populate(event)
  self.id = event.id
  self.param = event.param
  self.time = event.time
  return self
end

local homeResidentInfo = class("homeResidentInfo")
dataCls.homeResidentInfo = homeResidentInfo

function homeResidentInfo:ctor(id)
  self.id = id
  self.type = 0
  self.level = 0
  self.workBuilding = 0
  self.events = {}
  self.next_event_time = 0
  self.is_in_home = true
end

function homeResidentInfo:populate(data)
  self.type = data.type
  self.level = data.level
  self.workBuilding = data.work_building
  self.next_event_time = data.next_event_time
  self.is_in_home = data.is_in_home
  self.events = {}
  for _, event in ipairs(data.events or {}) do
    table.insert(self.events, homeResidentEventInfo.new():populate(event))
  end
  return self
end

this.dataCls = dataCls
return this
