#pragma once
#include <string>
#include <vector>
#include "Pawn.hpp"
#include "Utils.hpp"

class Player {
	public:
		Player(const std::string& name, unsigned int seed, short color);

		// Akcesory
		const std::string& getName() const;
		unsigned int getSeed() const;
		int getRollCount() const;
		short getColor() const;
		short* getRelativePawns();
		bool isPawnAtHome(short pawnId);

		void incrementRollCount();

		// Zarządzanie pionkami
		void initializePawns(int totalPawns);
		void movePawn(int pawnIndex, int steps);
		short tryMovingPawn(short pawnID, short fields);
		void sendToBase(short pawnNumber);
		void sendToBoard(short pawnNumber);
		void unsafeMovePiece(short pawnNumber, short steps);
		std::vector<Pawn>& getPawns();
		short pawnsAtBase = 4;
		short pawnsActive = 0;
		short pawnsAtHome = 0;
		void recalculatePawnStates();

		bool hasWon() const;
		bool hasLeftBase = false;

	private:
		std::string name;
		unsigned int seed;
		std::vector<Pawn> pawns;
		short color;
		short relativePawns[4] = {-1, -1, -1, -1};

		int rollCount = 0;

		int pawnsFinished; // to nie to samo, co pawnsAtHome
};