// Copyright Pacificao. All Rights Reserved.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/HUD.h"
#include "AgrarianDebugHUD.generated.h"

class UAgrarianInventoryComponent;
class UAgrarianCraftingComponent;
class UAgrarianSurvivalComponent;

UCLASS()
class AAgrarianDebugHUD : public AHUD
{
	GENERATED_BODY()

public:
	virtual void DrawHUD() override;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|HUD")
	bool bShowDebugHUD = true;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|HUD")
	bool bShowCriticalStatsHUD = true;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|HUD")
	bool bShowInventoryHUD = true;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|HUD")
	bool bShowCraftingHUD = true;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|HUD", meta = (ClampMin = "0.25"))
	float TextScale = 1.0f;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|HUD", meta = (ClampMin = "0.25"))
	float CriticalStatsTextScale = 1.0f;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|HUD", meta = (ClampMin = "0.25"))
	float InventoryTextScale = 0.9f;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|HUD", meta = (ClampMin = "1", ClampMax = "12"))
	int32 MaxInventoryPanelRows = 6;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|HUD", meta = (ClampMin = "1", ClampMax = "12"))
	int32 MaxCraftingPanelRows = 8;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|HUD")
	bool bShowInteractionPrompt = true;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|HUD", meta = (ClampMin = "0.25"))
	float PromptTextScale = 1.15f;

protected:
	void DrawInteractionPrompt(const class AAgrarianGameCharacter* AgrarianCharacter);
	void DrawCriticalStats(const UAgrarianSurvivalComponent* SurvivalComponent);
	float DrawInventoryPanel(const class AAgrarianGameCharacter* AgrarianCharacter);
	void DrawCraftingPanel(const class AAgrarianGameCharacter* AgrarianCharacter, float TopY);
	void DrawPlayerStatus(const class AAgrarianGameCharacter* AgrarianCharacter, float X, float& Y);
	void DrawSurvival(const UAgrarianSurvivalComponent* SurvivalComponent, float X, float& Y);
	void DrawInventory(const UAgrarianInventoryComponent* InventoryComponent, float X, float& Y);
	void DrawLine(const FString& Text, float X, float& Y, const FColor& Color = FColor::White);
	void DrawScaledLine(const FString& Text, float X, float& Y, float Scale, const FColor& Color = FColor::White);
};
