#pragma once

#include "Mobs.h"

namespace td {
namespace game {

class PlayerUpgrades {
private:
	std::uint8_t m_ClickerLevel;
	std::uint8_t m_GoldPerSecond;
	std::array<std::uint8_t, static_cast<std::size_t>(MobType::MOB_COUNT)> m_MobsUpgradeLevel;
public:
	static const int MAX_MOB_LEVEL = 5;
	static const int MAX_CLICKER_LEVEL = 3;

	PlayerUpgrades() : m_ClickerLevel(1), m_GoldPerSecond(5) {}

	std::uint8_t GetClickerLevel() const { return m_ClickerLevel; }
	std::uint8_t GetMobUpgradeLevel(MobType mob) const { return m_MobsUpgradeLevel.at(static_cast<std::size_t>(mob)); }
	std::uint8_t GetGoldPerSecond() const { return m_GoldPerSecond; }


	void UpgradeMob(MobType mob) {
		std::uint8_t& mobLevel = m_MobsUpgradeLevel.at(static_cast<std::size_t>(mob));
		mobLevel = std::min(mobLevel + 1, MAX_MOB_LEVEL);
	}

	void UpgradeClicker() { m_ClickerLevel = std::min(m_ClickerLevel + 1, MAX_CLICKER_LEVEL); }
	void SetGoldPerSecond(std::uint8_t goldPerSecond) { m_GoldPerSecond = goldPerSecond; }
};

} // namespace game
} // namespace td
