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

#pragma once

#include "CoreMinimal.h"
#include "CommonUserWidget.h"
#include "HUDCommissionTrackerWidget.generated.h"

class UPanelWidget;
class UForumCommissionWidget;
class UMissionSubsystem;

// On-screen tracker for accepted commissions (GDD §13 / Phase 7 objective-tracker), so the player can
// read their active objectives during play without opening the phone forum. Mirrors the forum's accepted
// section: reads the live board from UMissionSubsystem, rebuilds on OnBoardChanged, and reuses the forum
// row class for per-objective progress polling. Display-only — no accept / abandon controls.
UCLASS(Abstract)
class NAKEDDESIRE_API UHUDCommissionTrackerWidget : public UCommonUserWidget
{
	GENERATED_BODY()

protected:
	virtual void NativeConstruct() override;
	virtual void NativeDestruct() override;

private:
	// Holds one row per accepted commission.
	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UPanelWidget> CommissionContainer;

	UPROPERTY(EditDefaultsOnly, Category = "HUD")
	TSubclassOf<UForumCommissionWidget> CommissionEntryClass;

	// Bound to UMissionSubsystem::OnBoardChanged (a dynamic delegate, hence UFUNCTION).
	UFUNCTION()
	void Rebuild();

	UMissionSubsystem* GetMissionSubsystem() const;
};