// © 2025 Naked People Team. All Rights Reserved.

#pragma once

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


class UMission;
class ANakedDesireCharacter;

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnMissionCompletedSignature, UMission*, Mission);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnRewardsCollected, int, Reward);

UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class NAKEDDESIRE_API UMissionsManager : public UActorComponent
{
	GENERATED_BODY()

	UPROPERTY()
	ANakedDesireCharacter* Player = nullptr;

public:
	UMissionsManager();

	UPROPERTY(EditDefaultsOnly, Instanced, BlueprintReadOnly)
	TArray<UMission*> AvailableMissions;

	UPROPERTY(BlueprintReadWrite)
	TArray<UMission*> CompletedMissions;

	UPROPERTY(BlueprintAssignable)
	FOnMissionCompletedSignature OnMissionCompleted;
	
	UPROPERTY(BlueprintAssignable)
	FOnRewardsCollected OnRewardsCollected;

	void CompleteMission(UMission* Mission);

	UFUNCTION(BlueprintCallable)
	void CollectRewards();
	
	UFUNCTION()
	void RefreshDailyMissions(const TArray<UMission*>& NewMissions);

protected:
	virtual void BeginPlay() override;
};
