#pragma once
#include "Object.h"
#include "../Basic.h"
#include <Resource/DataArray.h>
#include <vector>
#include <Utils/Point2D.h>
#include <string>
#include <Resource/Folder.h>
#include "Item.h"
#include "Animation.h"

namespace assets
{
	class TownBuilding: public assets::Object
	{
	public:
		TownBuilding() {}
		void load(gge::resource::DataArray &dataArray);
		static TownBuilding &loadNew(gge::resource::DataArray &dataArray)
		{
			TownBuilding &tb = *new TownBuilding;
			tb.load(dataArray);
			return tb;
		}

		float HP;
		float armor;
		float odds;
		int   spacingRequirement;

		static std::map<std::string, TownBuilding*> list;
	};

	class MilitaryBuilding: public assets::Object
	{
	public:
		enum Type
		{
			Housing,
			Tools,
			Storage,
			MeleeTraining,
			RangedTraining
		};

		MilitaryBuilding() {}
		void load(gge::resource::DataArray &dataArray);
		static MilitaryBuilding &loadNew(gge::resource::DataArray &dataArray) {
			MilitaryBuilding &mil=*new MilitaryBuilding;
			mil.load(dataArray);
			return mil;
		}

		Type type;
		float HP;
		float armor;
		float constructionCost;
		float constructionTime;
		std::vector<gge::utils::Point> usablePoints;
		Item::Type storageType;
		int capacity;
		int maxLvl;
		int XPPerHit;

		static std::map<std::string, MilitaryBuilding*> list;
	};

	class Den: public assets::Object
	{
	public:
		Den() {}
		void load(gge::resource::Folder &folder);
		static Den &loadNew(gge::resource::Folder &folder)
		{
			Den &den = *new Den;
			den.load(folder);
			return den;
		}

		float HP;
		float armor;
		float initialAttackCD; // the cooldown before first attack occurs
		float regularAttackCD; // the cooldown between attacks after initial attack

		struct SpawnInfo
		{
			std::string ID;
			int   spawnCount;
			int	  initialSpawnCD; // the cooldown before first spawn occurs
			float regularSpawnCD; // the cooldown between spawns after first spawn
			float monsterLevel;
			int   maxMonster;
		};
		std::vector<SpawnInfo> wildlings;
		static std::map<std::string, Den*> list;
	};
}

