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

#import "DBClientInterface+Private.h"
#import "DBClientInterface.h"
#import "DBClientReturnedRecord+Private.h"
#import "DJIMarshal+Private.h"
#import "DJIObjcWrapperCache+Private.h"
#include <vector>

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

namespace { // anonymous namespace

class ObjcProxy final
: public ::ClientInterface
, public ::djinni::DbxObjcWrapperCache<ObjcProxy>::Handle
{
public:
    using Handle::Handle;
    ::ClientReturnedRecord get_record (int64_t record_id, const std::string & utf8string) override;
};

} // end anonymous namespace

namespace djinni_generated {

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

auto ClientInterface::fromCpp(const CppType& cpp) -> ObjcType
{
    assert(!cpp || dynamic_cast<ObjcProxy*>(cpp.get()));
    return cpp ? static_cast<ObjcProxy&>(*cpp).Handle::get() : nil;
}

}  // namespace djinni_generated

::ClientReturnedRecord ObjcProxy::get_record (int64_t record_id, const std::string & utf8string)
{
    @autoreleasepool {
        int64_t cpp_record_id = ::djinni::I64::fromCpp(record_id);
        NSString *cpp_utf8string = ::djinni::String::fromCpp(utf8string);
        DBClientReturnedRecord * objcRet = [Handle::get() getRecord:cpp_record_id utf8string:cpp_utf8string];
        ::ClientReturnedRecord cppRet = ::djinni_generated::ClientReturnedRecord::toCpp(objcRet);
        return cppRet;
    }
}
