local BAIT = {}

BAIT.Model = Model("models/props/de_inferno/goldfish.mdl")
BAIT.ClassName = "base_move"

if SERVER then
	function BAIT:PostInit()
		self:SetHealth(100)
		self:SetMaxHealth(100)
	end

	function BAIT:Think()
		local hook = self:GetParent()
		if hook.IsFishingHook and hook:WaterLevel() ~= 0 and not hook.attached.Fish:IsValid() then
			self:MoveHook(hook:GetPhysicsObject(), hook.rod.Owner)
		end

		self:NextThink(CurTime())
		return true
	end

	function BAIT:MoveHook()

	end

	function BAIT:AddHookVelocity(vel)
		local hook = self:GetParent()
		if hook.IsFishingHook and hook:WaterLevel() ~= 0 then
			hook:GetPhysicsObject():ApplyForceOffset(vel, hook:GetPos() + hook:GetUp() * 50)
		end
	end
	
	function BAIT:DrainHealth(fish)
		self:SetHealth(self:Health() - fish.BaitDamage)
		
		if self:Health() <= 0 then
			self:Remove()
		end
	end
end

fishing.RegisterBait(BAIT)