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

#pragma once

#include "CoreMinimal.h"
#include "CommonActivatableWidget.h"
#include "SettingsScreenWidget.generated.h"

class UTextButton;
class UWidgetSwitcher;
class UGameplaySettingsTab;
class UAudioSettingsTab;
class UGraphicsSettingsTab;

// Settings screen with Gameplay / Audio / Graphics tabs. Pushed onto a menu's ModalStack
// (assign as SettingsWidgetClass on the main / pause menus). Apply commits + persists;
// closing the screen also persists pending changes.
UCLASS(Abstract)
class NAKEDDESIRE_API USettingsScreenWidget : public UCommonActivatableWidget
{
	GENERATED_BODY()

protected:
	virtual void NativeOnActivated() override;
	virtual void NativeOnDeactivated() override;

private:
	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UWidgetSwitcher> TabSwitcher;

	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UTextButton> GameplayTabButton;

	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UTextButton> AudioTabButton;

	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UTextButton> GraphicsTabButton;

	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UTextButton> ApplyButton;

	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UTextButton> BackButton;

	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UGameplaySettingsTab> GameplayTab;

	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UAudioSettingsTab> AudioTab;

	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UGraphicsSettingsTab> GraphicsTab;

	UFUNCTION()
	void ShowGameplayTab();

	UFUNCTION()
	void ShowAudioTab();

	UFUNCTION()
	void ShowGraphicsTab();

	UFUNCTION()
	void OnApplyClicked();

	UFUNCTION()
	void OnBackClicked();

	void PersistSettings();
};