#pragma once
#include <string>
#include <unordered_map>
#include <vector>
#include "ClientState.h"

// NetworkInterface.h - »нтерфейс дл¤ разных типов соединений
namespace ZL {

	struct ProjectileInfo {
		int shooterId = -1;
		uint64_t clientTime = 0;
		Eigen::Vector3f position = Eigen::Vector3f::Zero();
		//Eigen::Vector3f direction = Eigen::Vector3f::Zero();
		Eigen::Matrix3f rotation = Eigen::Matrix3f::Identity();
		float velocity = 0;
	};

	struct DeathInfo {
		int targetId = -1;
		uint64_t serverTime = 0;
		Eigen::Vector3f position = Eigen::Vector3f::Zero();
		int killerId = -1;
	};

	struct BoxDestroyedInfo {
		int boxIndex = -1;
		uint64_t serverTime = 0;
		Eigen::Vector3f position = Eigen::Vector3f::Zero();
		int destroyedBy = -1;
	};

	struct BoxPickedUpInfo {
		int boxIndex = -1;
		int pickedUpBy = -1;
	};

	struct BoxRespawnInfo {
		int boxIndex = -1;
		Eigen::Vector3f position = Eigen::Vector3f::Zero();
		Eigen::Matrix3f rotation = Eigen::Matrix3f::Identity();
	};

	class INetworkClient {
	public:
		virtual ~INetworkClient() = default;
		virtual void Connect(const std::string& host, uint16_t port) = 0;
		virtual void Disconnect() {}
		virtual void Send(const std::string& message) = 0;
		virtual bool IsConnected() const = 0;
		virtual void Poll() = 0; // ƒл¤ обработки вход¤щих пакетов
		virtual std::unordered_map<int, ClientStateInterval> getRemotePlayers() = 0;

		virtual std::vector<std::pair<Eigen::Vector3f, Eigen::Matrix3f>> getServerBoxes() = 0;

		virtual std::vector<bool> getServerBoxDestroyedFlags() { return {}; }

		virtual std::vector<ProjectileInfo> getPendingProjectiles() = 0;

		virtual std::vector<DeathInfo> getPendingDeaths() = 0;
		virtual std::vector<int> getPendingRespawns() = 0;
		virtual int GetClientId() const { return -1; }
		virtual std::vector<BoxDestroyedInfo> getPendingBoxDestructions() = 0;
		virtual std::vector<BoxPickedUpInfo> getPendingBoxPickups() { return {}; }
		virtual std::vector<BoxRespawnInfo> getPendingBoxRespawns() { return {}; }
		virtual int64_t getTimeOffset() const { return 0; }
		virtual std::vector<int> getPendingDisconnects() { return {}; }

	};
}
