/*
PolyGun

Copyright (c) 2023 mrkubax10 <mrkubax10@onet.pl>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

#ifndef POLYGUN_SERVER_CLIENT_HPP
#define POLYGUN_SERVER_CLIENT_HPP

#include <glm/glm.hpp>

#include "common/network/network_manager.hpp"

namespace polygun::server {
	class Client final {
	public:
		Client(std::unique_ptr<polygun::network::NetworkManager> network_manager);
		~Client() = default;

		void set_position(const glm::vec3& pos) { m_pos = pos; }
		void set_nick(const std::string& nick) { m_nick = nick; }
		void set_uuid(uint32_t uuid) { m_uuid = uuid; }
		void set_join_completed_flag() { m_join_completed = true; }
		void update_activity();

		const glm::vec3& get_position() const { return m_pos; }
		polygun::network::NetworkManager& get_connection() { return *m_network_manager.get(); }
		const std::string& get_nick() const { return m_nick; }
		uint32_t get_uuid() const { return m_uuid; }
		bool get_join_completed() const { return m_join_completed; }
		time_t get_last_activity() const { return m_last_activity; }

	private:
		std::unique_ptr<polygun::network::NetworkManager> m_network_manager;
		std::string m_nick;
		uint32_t m_uuid;
		glm::vec3 m_pos;
		bool m_join_completed;
		time_t m_last_activity;
	};
}

#endif // POLYGUN_SERVER_CLIENT_HPP
