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

#pragma once

#include "CoreMinimal.h"
#include "Components/BoxComponent.h"
#include "Engine/StaticMeshActor.h"

#include "ShelfComponent.generated.h"


UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class FAYE_API UShelfComponent : public UBoxComponent
{
	GENERATED_BODY()

public:

	UShelfComponent();
	
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
	UMaterialInterface* TransparentBookMaterial = nullptr;
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
	UMaterialInterface* TransparentBookMaterial_Highlighted = nullptr;
	
	UFUNCTION(CallInEditor, BlueprintCallable)
	void GenerateBookRow();
	
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	TArray<AStaticMeshActor*> ShelfStaticMeshes;
	
protected:
	
	UPROPERTY()
	TArray<int32> ShelfSizesStack;
	
	const float FinalScale = 0.65f;
	
	UFUNCTION()
	void SpawnStaticMesh(const FSoftObjectPath& Path, UObject* Object, float BookXOffset);

	virtual void BeginPlay() override;
	void LoadMaterials();
};
