// Georgy Treshchev 2026 All Rights Reserved.

#pragma once

#include "CoreMinimal.h"
#include "IDetailCustomization.h"
#include "RuntimeVoskModelTypes.h"
#include "Widgets/Notifications/SProgressBar.h"
#include "Widgets/Input/SButton.h"

class IDetailGroup;

class FRuntimeSpeechRecognizerVoskSettingsDetails : public IDetailCustomization
{
public:
	static TSharedRef<IDetailCustomization> MakeInstance();

	virtual void CustomizeDetails(IDetailLayoutBuilder& DetailLayout) override;
	virtual void CustomizeDetails(const TSharedPtr<IDetailLayoutBuilder>& DetailBuilder) override;

private:
	TWeakPtr<IDetailLayoutBuilder> CachedDetailBuilder;
	void ForceRefreshDetails();

	struct FVoskModelWidgets
	{
		TSharedPtr<SProgressBar> ProgressBar;
		TSharedPtr<SButton> DownloadButton;
		TSharedPtr<SButton> CancelButton;
		TSharedPtr<SButton> DeleteButton;
	};
	TMap<FString, FVoskModelWidgets> ModelIdToWidgetsMap;

	void AddModelRow(IDetailGroup& Group, const FVoskModelVariant& Variant);
	void SetProgress(const FString& ModelId, float Progress);
};