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

#include "NativeEnumUsageInterface.hpp"  // my header
#include "Marshal.hpp"
#include "NativeColor.hpp"

namespace djinni_generated {

NativeEnumUsageInterface::NativeEnumUsageInterface() : ::djinni::JniInterface<::testsuite::EnumUsageInterface, NativeEnumUsageInterface>("com/dropbox/djinni/test/EnumUsageInterface$CppProxy") {}

NativeEnumUsageInterface::~NativeEnumUsageInterface() = default;

NativeEnumUsageInterface::JavaProxy::JavaProxy(JniType j) : Handle(::djinni::jniGetThreadEnv(), j) { }

NativeEnumUsageInterface::JavaProxy::~JavaProxy() = default;

::testsuite::color NativeEnumUsageInterface::JavaProxy::e(::testsuite::color c_e) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::djinni_generated::NativeEnumUsageInterface>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_e,
                                         ::djinni::get(::djinni_generated::NativeColor::fromCpp(jniEnv, c_e)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni_generated::NativeColor::toCpp(jniEnv, jret);
}
std::experimental::optional<::testsuite::color> NativeEnumUsageInterface::JavaProxy::o(std::experimental::optional<::testsuite::color> c_o) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::djinni_generated::NativeEnumUsageInterface>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_o,
                                         ::djinni::get(::djinni::Optional<std::experimental::optional, ::djinni_generated::NativeColor>::fromCpp(jniEnv, c_o)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Optional<std::experimental::optional, ::djinni_generated::NativeColor>::toCpp(jniEnv, jret);
}
std::vector<::testsuite::color> NativeEnumUsageInterface::JavaProxy::l(const std::vector<::testsuite::color> & c_l) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::djinni_generated::NativeEnumUsageInterface>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_l,
                                         ::djinni::get(::djinni::List<::djinni_generated::NativeColor>::fromCpp(jniEnv, c_l)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::List<::djinni_generated::NativeColor>::toCpp(jniEnv, jret);
}
std::unordered_set<::testsuite::color> NativeEnumUsageInterface::JavaProxy::s(const std::unordered_set<::testsuite::color> & c_s) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::djinni_generated::NativeEnumUsageInterface>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_s,
                                         ::djinni::get(::djinni::Set<::djinni_generated::NativeColor>::fromCpp(jniEnv, c_s)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Set<::djinni_generated::NativeColor>::toCpp(jniEnv, jret);
}
std::unordered_map<::testsuite::color, ::testsuite::color> NativeEnumUsageInterface::JavaProxy::m(const std::unordered_map<::testsuite::color, ::testsuite::color> & c_m) {
    auto jniEnv = ::djinni::jniGetThreadEnv();
    ::djinni::JniLocalScope jscope(jniEnv, 10);
    const auto& data = ::djinni::JniClass<::djinni_generated::NativeEnumUsageInterface>::get();
    auto jret = jniEnv->CallObjectMethod(Handle::get().get(), data.method_m,
                                         ::djinni::get(::djinni::Map<::djinni_generated::NativeColor, ::djinni_generated::NativeColor>::fromCpp(jniEnv, c_m)));
    ::djinni::jniExceptionCheck(jniEnv);
    return ::djinni::Map<::djinni_generated::NativeColor, ::djinni_generated::NativeColor>::toCpp(jniEnv, jret);
}

CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_EnumUsageInterface_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{
    try {
        DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
        delete reinterpret_cast<::djinni::CppProxyHandle<::testsuite::EnumUsageInterface>*>(nativeRef);
    } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}

CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_EnumUsageInterface_00024CppProxy_native_1e(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jobject j_e)
{
    try {
        DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
        const auto& ref = ::djinni::objectFromHandleAddress<::testsuite::EnumUsageInterface>(nativeRef);
        auto r = ref->e(::djinni_generated::NativeColor::toCpp(jniEnv, j_e));
        return ::djinni::release(::djinni_generated::NativeColor::fromCpp(jniEnv, r));
    } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}

CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_EnumUsageInterface_00024CppProxy_native_1o(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jobject j_o)
{
    try {
        DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
        const auto& ref = ::djinni::objectFromHandleAddress<::testsuite::EnumUsageInterface>(nativeRef);
        auto r = ref->o(::djinni::Optional<std::experimental::optional, ::djinni_generated::NativeColor>::toCpp(jniEnv, j_o));
        return ::djinni::release(::djinni::Optional<std::experimental::optional, ::djinni_generated::NativeColor>::fromCpp(jniEnv, r));
    } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}

CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_EnumUsageInterface_00024CppProxy_native_1l(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jobject j_l)
{
    try {
        DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
        const auto& ref = ::djinni::objectFromHandleAddress<::testsuite::EnumUsageInterface>(nativeRef);
        auto r = ref->l(::djinni::List<::djinni_generated::NativeColor>::toCpp(jniEnv, j_l));
        return ::djinni::release(::djinni::List<::djinni_generated::NativeColor>::fromCpp(jniEnv, r));
    } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}

CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_EnumUsageInterface_00024CppProxy_native_1s(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jobject j_s)
{
    try {
        DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
        const auto& ref = ::djinni::objectFromHandleAddress<::testsuite::EnumUsageInterface>(nativeRef);
        auto r = ref->s(::djinni::Set<::djinni_generated::NativeColor>::toCpp(jniEnv, j_s));
        return ::djinni::release(::djinni::Set<::djinni_generated::NativeColor>::fromCpp(jniEnv, r));
    } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}

CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_EnumUsageInterface_00024CppProxy_native_1m(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, jobject j_m)
{
    try {
        DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
        const auto& ref = ::djinni::objectFromHandleAddress<::testsuite::EnumUsageInterface>(nativeRef);
        auto r = ref->m(::djinni::Map<::djinni_generated::NativeColor, ::djinni_generated::NativeColor>::toCpp(jniEnv, j_m));
        return ::djinni::release(::djinni::Map<::djinni_generated::NativeColor, ::djinni_generated::NativeColor>::fromCpp(jniEnv, r));
    } JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}

}  // namespace djinni_generated
