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

#import "DBExternInterface2+Private.h"
#import "DBExternInterface2.h"
#import "DBExternRecordWithDerivings+Private.h"
#import "DBTestHelpers+Private.h"
#import "DJIObjcWrapperCache+Private.h"

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

namespace djinni_generated {

class ExternInterface2::ObjcProxy final
: public ::ExternInterface2
, public ::djinni::DbxObjcWrapperCache<ObjcProxy>::Handle
{
public:
    using Handle::Handle;
    ::ExternRecordWithDerivings foo(const std::shared_ptr<::TestHelpers> & c_i) override
    {
        @autoreleasepool {
            auto r = [(ObjcType)Handle::get() foo:(::djinni_generated::TestHelpers::fromCpp(c_i))];
            return ::djinni_generated::ExternRecordWithDerivings::toCpp(r);
        }
    }
};

}  // namespace djinni_generated

namespace djinni_generated {

auto ExternInterface2::toCpp(ObjcType objc) -> CppType
{
    if (!objc) {
        return nullptr;
    }
    return ::djinni::DbxObjcWrapperCache<ObjcProxy>::getInstance()->get(objc);
}

auto ExternInterface2::fromCpp(const CppType& cpp) -> ObjcType
{
    if (!cpp) {
        return nil;
    }
    return dynamic_cast<ObjcProxy&>(*cpp).Handle::get();
}

}  // namespace djinni_generated
