// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from wchar_test.djinni

#import "DBWcharTestHelpers+Private.h"
#import "DBWcharTestHelpers.h"
#import "DBWcharTestRec+Private.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
#include <exception>
#include <stdexcept>
#include <utility>

static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");

@interface DBWcharTestHelpers ()

- (id)initWithCpp:(const std::shared_ptr<::testsuite::WcharTestHelpers>&)cppRef;

@end

@implementation DBWcharTestHelpers {
    ::djinni::CppProxyCache::Handle<std::shared_ptr<::testsuite::WcharTestHelpers>> _cppRefHandle;
}

- (id)initWithCpp:(const std::shared_ptr<::testsuite::WcharTestHelpers>&)cppRef
{
    if (self = [super init]) {
        _cppRefHandle.assign(cppRef);
    }
    return self;
}

+ (nonnull DBWcharTestRec *)getRecord {
    try {
        auto objcpp_result_ = ::testsuite::WcharTestHelpers::get_record();
        return ::djinni_generated::WcharTestRec::fromCpp(objcpp_result_);
    } DJINNI_TRANSLATE_EXCEPTIONS()
}

+ (nonnull NSString *)getString {
    try {
        auto objcpp_result_ = ::testsuite::WcharTestHelpers::get_string();
        return ::djinni::WString::fromCpp(objcpp_result_);
    } DJINNI_TRANSLATE_EXCEPTIONS()
}

+ (BOOL)checkString:(nonnull NSString *)str {
    try {
        auto objcpp_result_ = ::testsuite::WcharTestHelpers::check_string(::djinni::WString::toCpp(str));
        return ::djinni::Bool::fromCpp(objcpp_result_);
    } DJINNI_TRANSLATE_EXCEPTIONS()
}

+ (BOOL)checkRecord:(nonnull DBWcharTestRec *)rec {
    try {
        auto objcpp_result_ = ::testsuite::WcharTestHelpers::check_record(::djinni_generated::WcharTestRec::toCpp(rec));
        return ::djinni::Bool::fromCpp(objcpp_result_);
    } DJINNI_TRANSLATE_EXCEPTIONS()
}

namespace djinni_generated {

auto WcharTestHelpers::toCpp(ObjcType objc) -> CppType
{
    if (!objc) {
        return nullptr;
    }
    return objc->_cppRefHandle.get();
}

auto WcharTestHelpers::fromCppOpt(const CppOptType& cpp) -> ObjcType
{
    if (!cpp) {
        return nil;
    }
    return ::djinni::get_cpp_proxy<DBWcharTestHelpers>(cpp);
}

}  // namespace djinni_generated

@end
