// Copyright (c) 2024 Codemongous LLC. All Rights Reserved.

#include "SCW_FObjectPropertyBase.h"
#include "UObject/UnrealType.h"
#include "SourcifyCoreUEWrapperModule.h"

using namespace Sourcify;

SCW_FObjectPropertyBase::SCW_FObjectPropertyBase(FObjectPropertyBase* InObjectPropertyBase) : SCW_FProperty(InObjectPropertyBase), ObjectPropertyBase(InObjectPropertyBase)
{

}

#if ISCW_UE_VERSION_OLDER_THAN(5, 7, 0)
wstring SCW_FObjectPropertyBase::GetCPPTypeCustom(wstring* ExtendedTypeText, SCW_EPropertyExportCPPFlags CPPExportFlags, const wstring& InnerNativeTypeName) const
{
	FString ExtendedTypeTextFString = ExtendedTypeText ? ExtendedTypeText->c_str() : TEXT("");
	return TCHAR_TO_WCHAR(*ObjectPropertyBase->GetCPPTypeCustom(ExtendedTypeText ? &ExtendedTypeTextFString : nullptr, static_cast<uint32_t>(CPPExportFlags), InnerNativeTypeName.c_str()));
}
#endif

ISCW_UClassPtr SCW_FObjectPropertyBase::GetPropertyClass() const
{
	return FSourcifyCoreUEWrapper::Get().Wrap(*ObjectPropertyBase->PropertyClass);
}

FObjectPropertyBase* SCW_FObjectPropertyBase::ToFObjectPropertyBase() const
{
	return ObjectPropertyBase;
}

ISCW_FObjectPropertyBasePtr SCW_FObjectPropertyBase::ToFObjectPropertyBasePtr()
{
	return GetSharedThisAs<SCW_FObjectPropertyBase>();
}

ISCW_FObjectPropertyBaseConstPtr SCW_FObjectPropertyBase::ToFObjectPropertyBasePtr() const
{
	return GetSharedThisAs<SCW_FObjectPropertyBase>();
}
