#include "client/gui/BlitzGui.h"

#include "client/gui/Crosshair.h"
#include "client/gui/GameChatGui.h"
#include "client/gui/Hud.h"
#include "client/gui/LeaderBoardGui.h"
#include "client/gui/MainMenu.h"
#include "client/gui/ServerGui.h"
#include <imgui.h>

namespace blitz {
namespace gui {

BlitzGui::BlitzGui(Client* client) : GuiWidget(nullptr, client) {
	Enable();
	AddWidget(std::make_unique<GameChatGui>(this, client));
	AddWidget(std::make_unique<MainMenu>(client));
	AddWidget(std::make_unique<CrossHair>(client));
	AddWidget(std::make_unique<Hud>(this, client));
	AddWidget(std::make_unique<LeaderBoardGui>(this, client));
	AddWidget(std::make_unique<ServerGui>(this, client));
	SetCustomTheme();
}

void BlitzGui::Render() {
	GuiWidget::Render();
}

void BlitzGui::SetCustomTheme() {
	const static ImVec4 colorButton = {1.0f, 0.0f, 0.0f, 0.73f};
	const static ImVec4 colorButtonHover = {0.56f, 0.02f, 0.02f, 1.0f};
	const static ImVec4 colorButtonActive = {0.36f, 0.03f, 0.03f, 1.0f};
	const static ImVec4 colorCheckMark = {1.0f, 1.0f, 1.0f, 1.0f};
	const static ImVec4 colorTab = {0.38f, 0.02f, 0.02f, 1.0f};
	const static ImVec4 colorTabHover = {0.74f, 0.0f, 0.0f, 0.73f};
	const static ImVec4 colorTabActive = {1.0f, 0.0f, 0.0f, 0.73f};


	ImGui::GetStyle().Colors[ImGuiCol_Button] = colorButton;
	ImGui::GetStyle().Colors[ImGuiCol_ButtonActive] = colorButtonActive;
	ImGui::GetStyle().Colors[ImGuiCol_ButtonHovered] = colorButtonHover;
	ImGui::GetStyle().Colors[ImGuiCol_CheckMark] = colorCheckMark;
	ImGui::GetStyle().Colors[ImGuiCol_FrameBg] = colorButton;
	ImGui::GetStyle().Colors[ImGuiCol_FrameBgActive] = colorButtonActive;
	ImGui::GetStyle().Colors[ImGuiCol_FrameBgHovered] = colorButtonHover;
	ImGui::GetStyle().Colors[ImGuiCol_Tab] = colorTab;
	ImGui::GetStyle().Colors[ImGuiCol_TabHovered] = colorTabHover;
	ImGui::GetStyle().Colors[ImGuiCol_TabActive] = colorTabActive;
	ImGui::GetStyle().Colors[ImGuiCol_TitleBgActive] = colorTabActive;
	ImGui::GetStyle().Colors[ImGuiCol_SliderGrab] = colorButton;
	ImGui::GetStyle().Colors[ImGuiCol_SliderGrabActive] = colorButton;
	ImGui::GetStyle().Colors[ImGuiCol_HeaderActive] = colorTab;
	ImGui::GetStyle().Colors[ImGuiCol_HeaderHovered] = colorTabActive;
	ImGui::GetStyle().Colors[ImGuiCol_Header] = colorTabActive;
}

}  // namespace gui
}  // namespace blitz
