#include "./AssetManager.h"

#include <map>

static const unsigned char data_fonts_pressstart_prstart_ttf[] = {
	#include <data/fonts/pressstart/prstart.ttf.h>
};

static const unsigned char data_fonts_pressstart_prstartk_ttf[] = {
	#include <data/fonts/pressstart/prstartk.ttf.h>
};

static const unsigned char data_images_keybinds_Rotate180_png[] = {
	#include <data/images/keybinds/Rotate180.png.h>
};

static const unsigned char data_images_keybinds_Rotate0_png[] = {
	#include <data/images/keybinds/Rotate0.png.h>
};

static const unsigned char data_images_keybinds_RotateCCW_png[] = {
	#include <data/images/keybinds/RotateCCW.png.h>
};

static const unsigned char data_images_keybinds_Retry_png[] = {
	#include <data/images/keybinds/Retry.png.h>
};

static const unsigned char data_images_keybinds_RotateCW_png[] = {
	#include <data/images/keybinds/RotateCW.png.h>
};

static const unsigned char data_images_keybinds_Moveright_png[] = {
	#include <data/images/keybinds/Moveright.png.h>
};

static const unsigned char data_images_keybinds_Harddrop_png[] = {
	#include <data/images/keybinds/Harddrop.png.h>
};

static const unsigned char data_images_keybinds_Moveleft_png[] = {
	#include <data/images/keybinds/Moveleft.png.h>
};

static const unsigned char data_images_keybinds_Hold_png[] = {
	#include <data/images/keybinds/Hold.png.h>
};

static const unsigned char data_images_keybinds_Softdrop_png[] = {
	#include <data/images/keybinds/Softdrop.png.h>
};

static const unsigned char data_images_keybinds_Pause_png[] = {
	#include <data/images/keybinds/Pause.png.h>
};

static const Asset assets[] = {
	{data_fonts_pressstart_prstart_ttf, sizeof(data_fonts_pressstart_prstart_ttf)},
	{data_fonts_pressstart_prstartk_ttf, sizeof(data_fonts_pressstart_prstartk_ttf)},
	{data_images_keybinds_Rotate180_png, sizeof(data_images_keybinds_Rotate180_png)},
	{data_images_keybinds_Rotate0_png, sizeof(data_images_keybinds_Rotate0_png)},
	{data_images_keybinds_RotateCCW_png, sizeof(data_images_keybinds_RotateCCW_png)},
	{data_images_keybinds_Retry_png, sizeof(data_images_keybinds_Retry_png)},
	{data_images_keybinds_RotateCW_png, sizeof(data_images_keybinds_RotateCW_png)},
	{data_images_keybinds_Moveright_png, sizeof(data_images_keybinds_Moveright_png)},
	{data_images_keybinds_Harddrop_png, sizeof(data_images_keybinds_Harddrop_png)},
	{data_images_keybinds_Moveleft_png, sizeof(data_images_keybinds_Moveleft_png)},
	{data_images_keybinds_Hold_png, sizeof(data_images_keybinds_Hold_png)},
	{data_images_keybinds_Softdrop_png, sizeof(data_images_keybinds_Softdrop_png)},
	{data_images_keybinds_Pause_png, sizeof(data_images_keybinds_Pause_png)},

};

static const std::map<std::string, AssetName> assetMap = {
	{"data/fonts/pressstart/prstart.ttf", AssetName::data_fonts_pressstart_prstart_ttf},
	{"data/fonts/pressstart/prstartk.ttf", AssetName::data_fonts_pressstart_prstartk_ttf},
	{"data/images/keybinds/Rotate180.png", AssetName::data_images_keybinds_Rotate180_png},
	{"data/images/keybinds/Rotate0.png", AssetName::data_images_keybinds_Rotate0_png},
	{"data/images/keybinds/RotateCCW.png", AssetName::data_images_keybinds_RotateCCW_png},
	{"data/images/keybinds/Retry.png", AssetName::data_images_keybinds_Retry_png},
	{"data/images/keybinds/RotateCW.png", AssetName::data_images_keybinds_RotateCW_png},
	{"data/images/keybinds/Moveright.png", AssetName::data_images_keybinds_Moveright_png},
	{"data/images/keybinds/Harddrop.png", AssetName::data_images_keybinds_Harddrop_png},
	{"data/images/keybinds/Moveleft.png", AssetName::data_images_keybinds_Moveleft_png},
	{"data/images/keybinds/Hold.png", AssetName::data_images_keybinds_Hold_png},
	{"data/images/keybinds/Softdrop.png", AssetName::data_images_keybinds_Softdrop_png},
	{"data/images/keybinds/Pause.png", AssetName::data_images_keybinds_Pause_png},

};

const Asset& getResource(AssetName fileName) {
	return assets[static_cast<std::size_t>(fileName)];
}

const Asset& getResource(const std::string& fileName) {
	return getResource(assetMap.at(fileName));
}
