local META = {}

function META:__index(key)
	self = self.player
	if not self:IsValid() then return end

	if SERVER and not self.fishing_initialized then
		local data = self:GetLuaDataOption("fishing") or {}

		for key, val in pairs(data) do
			self:SetNetData("fishing_" .. key, val)
		end

		self.fishing_vars = data
		self.fishing_initialized = true
	end

	return self:GetNetData("fishing_" .. key)
end

function META:__newindex(key, val)
	self = self.player
	if CLIENT or not self:IsValid() then return end

	self.fishing_vars = self.fishing_vars or {}
	self.fishing_vars[key] = val
	self:SetLuaDataOption("fishing", self.fishing_vars)

	self:SetNetData("fishing_" .. key, val)
end

function fishing.GetStats(ent)
	return setmetatable({player = ent or NULL}, META)
end
