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

#include "InworldCharacterEditor.h"

#include "Components/InworldBaseCharacterComponent.h"
#include "Customizations/InworldCharacterComponentDetailsCustomization.h"
#include "PropertyEditorModule.h"

#define LOCTEXT_NAMESPACE "FInworldCharacterEditorModule"

void FInworldCharacterEditorModule::StartupModule()
{
	FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
	PropertyModule.RegisterCustomClassLayout(UInworldBaseCharacterComponent::StaticClass()->GetFName(),
		FOnGetDetailCustomizationInstance::CreateStatic(&FInworldCharacterComponentDetailsCustomization::MakeInstance));
}

void FInworldCharacterEditorModule::ShutdownModule()
{
	if (FModuleManager::Get().IsModuleLoaded("PropertyEditor"))
	{
		FPropertyEditorModule& PropertyModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor");
		PropertyModule.UnregisterCustomClassLayout(UInworldBaseCharacterComponent::StaticClass()->GetFName());
	}
}

IMPLEMENT_MODULE(FInworldCharacterEditorModule, InworldCharacterEditor)
#undef LOCTEXT_NAMESPACE
