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

#pragma once

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

class UComboBoxString;
class UCheckBox;

// Graphics settings tab. Overall quality, window mode, resolution and VSync, backed by the
// inherited UGameUserSettings. Changes stage into the settings object; the settings screen's
// Apply button calls ApplySettings to commit resolution/quality changes.
UCLASS(Abstract)
class NAKEDDESIRE_API UGraphicsSettingsTab : public UCommonUserWidget
{
	GENERATED_BODY()

public:
	void RefreshFromSettings();

protected:
	virtual void NativeConstruct() override;

private:
	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UComboBoxString> QualityCombo;

	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UComboBoxString> WindowModeCombo;

	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UComboBoxString> ResolutionCombo;

	UPROPERTY(meta = (BindWidget))
	TObjectPtr<UCheckBox> VSyncCheckBox;

	// Index-aligned with ResolutionCombo entries.
	TArray<FIntPoint> AvailableResolutions;

	UFUNCTION()
	void OnQualityChanged(FString SelectedItem, ESelectInfo::Type SelectionType);

	UFUNCTION()
	void OnWindowModeChanged(FString SelectedItem, ESelectInfo::Type SelectionType);

	UFUNCTION()
	void OnResolutionChanged(FString SelectedItem, ESelectInfo::Type SelectionType);

	UFUNCTION()
	void OnVSyncChanged(bool bIsChecked);
};