// Copyright CodeSpartan, 2022. All rights reserved.

#pragma once

#include "CoreMinimal.h"
#include "Engine/DataAsset.h"
#include "ItemAsset.generated.h"

class UTexture2D;
class UItemProperty;

/**
 * A base class for all types of Item Assets
 */
UCLASS(Blueprintable, BlueprintType)
class MMOKITCODE_API UItemAsset : public UPrimaryDataAsset
{
	GENERATED_BODY()
	
public:

	/** Must be set correctly, or the asset won't be gathered by the Asset Manager */
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Asset Manager")
	FPrimaryAssetType AssetType;

	UPROPERTY(EditInstanceOnly, BlueprintReadOnly, Category = Item)
	FText ItemName;

	UPROPERTY(EditInstanceOnly, BlueprintReadOnly, Category = Item)
	FText Description;

	UPROPERTY(EditInstanceOnly, BlueprintReadOnly, Category = Item)
	UTexture2D* Icon = nullptr;

	UPROPERTY(Instanced, EditInstanceOnly, BlueprintReadOnly, Category = Equipment)
	TArray<UItemProperty*> Properties;

	/** Returns the logical name, equivalent to the primary asset id */
	UFUNCTION(BlueprintCallable, Category = Item)
	FString GetIdentifierString() const;

	/** Overridden to use saved type */
	virtual FPrimaryAssetId GetPrimaryAssetId() const override;
};
