// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "BaseItem.generated.h"

USTRUCT(BlueprintType)
struct FItemSize
{
	GENERATED_BODY()

	UPROPERTY(BlueprintReadWrite, Category = "ItemSize")
	int X;
	UPROPERTY(BlueprintReadWrite, Category = "ItemSize")
	int Y;

	FItemSize(const int _X, const int _Y)
	{
		X = _X;
		Y = _Y;
	}

	FItemSize()
	{
		X = 1;
		Y = 1;
	}
};

UENUM(BlueprintType)
enum EItemRotation
{
	Horizontal UMETA(DisplayName = "Horizontal"),
	Vertical UMETA(DisplayName = "Vertical")
};

/**
 * 
 */
UCLASS(Abstract, Blueprintable)
class ENDLESSVENDETTA_API UBaseItem : public UObject
{
	GENERATED_BODY()

public:
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
	int ItemID;
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
	FName ItemName;
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
	FText Description;
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
	FVector2D DefaultItemSize = FVector2D(1);
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
	FItemSize ItemSize;
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
	UMaterialInterface* ItemTexture;
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
	UMaterialInterface* ItemTextureRotated;
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
	TEnumAsByte<EItemRotation> CurrentItemRotation = Horizontal;
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
	TSubclassOf<AActor> ItemActor;
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Item")
	bool bIsRotated = false;

	virtual void PostInitProperties() override;

	UFUNCTION(BlueprintCallable, Category = "Item")
	void RotateItem();
	UFUNCTION(BlueprintCallable, Category = "Item")
	UMaterialInterface* GetItemTexture() const;
};
