// Copyright Pacificao. All Rights Reserved.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "AgrarianFoliagePatch.generated.h"

class UHierarchicalInstancedStaticMeshComponent;
class USceneComponent;

UCLASS(Blueprintable)
class AGRARIANGAME_API AAgrarianFoliagePatch : public AActor
{
	GENERATED_BODY()

public:
	AAgrarianFoliagePatch();

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Foliage")
	TObjectPtr<USceneComponent> SceneRoot;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Foliage")
	TObjectPtr<UHierarchicalInstancedStaticMeshComponent> TreeInstances;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Foliage")
	TObjectPtr<UHierarchicalInstancedStaticMeshComponent> ShrubInstances;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Foliage")
	TObjectPtr<UHierarchicalInstancedStaticMeshComponent> GrassInstances;

	UFUNCTION(BlueprintCallable, Category = "Agrarian|Foliage")
	void ClearFoliage();

	UFUNCTION(BlueprintCallable, Category = "Agrarian|Foliage")
	int32 AddTreeInstance(const FTransform& InstanceTransform);

	UFUNCTION(BlueprintCallable, Category = "Agrarian|Foliage")
	int32 AddShrubInstance(const FTransform& InstanceTransform);

	UFUNCTION(BlueprintCallable, Category = "Agrarian|Foliage")
	int32 AddGrassInstance(const FTransform& InstanceTransform);

	UFUNCTION(BlueprintPure, Category = "Agrarian|Foliage")
	int32 GetTreeInstanceCount() const;

	UFUNCTION(BlueprintPure, Category = "Agrarian|Foliage")
	int32 GetShrubInstanceCount() const;

	UFUNCTION(BlueprintPure, Category = "Agrarian|Foliage")
	int32 GetGrassInstanceCount() const;
};
