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

#include "SCW_UField.h"
#include "UObject/Field.h"
#include "SourcifyCoreUEWrapperModule.h"

using namespace Sourcify;

SCW_UField::SCW_UField(UField* InField) : SCW_UObject(InField), Field(InField)
{

}

bool SCW_UField::GetBoolMetaData(const wstring& Key) const
{
	return Field->GetBoolMetaData(WCHAR_TO_TCHAR(Key.c_str()));
}

wstring SCW_UField::GetMetaData(const wstring& Key) const
{
	return *Field->GetMetaData(WCHAR_TO_TCHAR(Key.c_str()));
}

ISCW_UClassPtr SCW_UField::GetOwnerClass() const
{
	return FSourcifyCoreUEWrapper::Get().Wrap(*Field->GetOwnerClass());
}

bool SCW_UField::HasMetaData(const wstring& Key) const
{
	return Field->HasMetaData(WCHAR_TO_TCHAR(Key.c_str()));
}

bool SCW_UField::IsValidLowLevel() const
{
	return Field->IsValidLowLevel();
}

shared_ptr<ISCW_UField> SCW_UField::ToUFieldPtr()
{
	return GetSharedThisAs<SCW_UField>();
}

shared_ptr<const ISCW_UField> SCW_UField::ToUFieldPtr() const
{
	return GetSharedThisAs<SCW_UField>();
}