local this = class("petEntity", require(L_EcsConst.aliveType.default))

function this:initialize(petEntityData)
  this.super.initialize(self, petEntityData)
  self.fsmComponent = self:getFsmComponent(true)
  self.stateComponent = self:addComponent(L_EcsConst.componentType.state)
  self.modelControlComponent = self:addComponent(L_EcsConst.componentType.modelControl)
end

function this:reset()
  self.fsmComponent:reset()
end

function this:getEntityData()
  return self.entityData
end

function this:setRiderEntity(playerEntity)
  self.playerEntity = playerEntity
end

function this:getRider()
  return self.playerEntity
end

function this:getCanOperateJump()
  if self.csEntity == nil then
    return false
  end
  return self.csEntity.data.canOperateJumpState ~= 0
end

function this:getCanFly()
  local petId = self:getEntityData():getConfigId()
  local mountTpl = L_GameTpl:getMountTpl()
  local tpl = mountTpl:getTplById(petId)
  local canMountFly = mountTpl:getMountCanFly(tpl)
  return canMountFly
end

function this:getCanOperateDodge()
  if self.csEntity == nil then
    return false
  end
  return self.csEntity.data.canOperateDodge
end

function this:getId()
  return self.entityData.id
end

function this:getUnitId()
  return self.entityData.unitId
end

function this:transfer(pos, rot)
  self:reset()
  self:putIn(pos, rot)
end

return this
