/**
 * Copyright 2022-2025 Theai, Inc. dba Inworld AI
 */

#pragma once

#include "CoreMinimal.h"
#include "IDetailCustomization.h"
#include "PropertyHandle.h"

class IDetailLayoutBuilder;
class UInworldBaseCharacterComponent;

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

	virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override;

private:
	void OnCharacterIDChanged(TSharedPtr<FName> NewSelection, ESelectInfo::Type SelectInfo);
	TSharedRef<SWidget> OnGenerateCharacterIDWidget(TSharedPtr<FName> InItem) const;
	FText GetCurrentCharacterIDText() const;

	void OnCharacterDataTableChanged();

	TWeakObjectPtr<UInworldBaseCharacterComponent> TargetComponent;
	TSharedPtr<IPropertyHandle> CharacterIDHandle;
	TArray<TSharedPtr<FName>> CharacterIDOptions;

	IDetailLayoutBuilder* DetailBuilderPtr = nullptr;
};
