// 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"

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

namespace djinni_generated {

class ClientInterface::ObjcProxy final
: public ::testsuite::ClientInterface
, public ::djinni::DbxObjcWrapperCache<ObjcProxy>::Handle
{
public:
    using Handle::Handle;
    ::testsuite::ClientReturnedRecord get_record(int64_t c_record_id, const std::string & c_utf8string, const std::experimental::optional<std::string> & c_misc) override
    {
        @autoreleasepool {
            auto r = [(ObjcType)Handle::get() getRecord:(::djinni::I64::fromCpp(c_record_id))
                                             utf8string:(::djinni::String::fromCpp(c_utf8string))
                                                   misc:(::djinni::Optional<std::experimental::optional, ::djinni::String>::fromCpp(c_misc))];
            return ::djinni_generated::ClientReturnedRecord::toCpp(r);
        }
    }
    double identifier_check(const std::vector<uint8_t> & c_data, int32_t c_r, int64_t c_jret) override
    {
        @autoreleasepool {
            auto r = [(ObjcType)Handle::get() identifierCheck:(::djinni::Binary::fromCpp(c_data))
                                                            r:(::djinni::I32::fromCpp(c_r))
                                                         jret:(::djinni::I64::fromCpp(c_jret))];
            return ::djinni::F64::toCpp(r);
        }
    }
    std::string return_str() override
    {
        @autoreleasepool {
            auto r = [(ObjcType)Handle::get() returnStr];
            return ::djinni::String::toCpp(r);
        }
    }
};

}  // namespace djinni_generated

namespace djinni_generated {

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

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

}  // namespace djinni_generated
