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

#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "OrdersComponent.generated.h"

class ANpcPawn;
class UCoffeeFilter;

USTRUCT(BlueprintType)
struct FOrderData
{
	GENERATED_BODY()
	
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	UCoffeeFilter* Filter;
	
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	ANpcPawn* NpcPawn;
};

UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class FAYE_API UOrdersComponent : public UActorComponent
{
	GENERATED_BODY()

public:
	UOrdersComponent();
	
	UFUNCTION(BlueprintCallable, Category = "Orders")
	void AddOrder(UCoffeeFilter* Filter, ANpcPawn* InNpcPawn);
	
	UFUNCTION(BlueprintPure, Category = "Orders")
	const TArray<FOrderData>& GetOrders() const { return OrderList; }
	
	UFUNCTION(BlueprintPure, Category = "Orders")
	UCoffeeFilter* GetOrderForNpc(ANpcPawn* InNpcPawn) const;

protected:
	virtual void BeginPlay() override;
	
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
	TArray<FOrderData> OrderList;

};
