//
// This file was generated by //third_party/jni_zero/jni_zero.py
//
package org.jni_zero;

import android.graphics.Rect;
import java.util.Map;
import org.jni_zero.CheckDiscard;
import org.jni_zero.GEN_JNI;
import org.jni_zero.JniStaticTestMocker;
import org.jni_zero.NativeLibraryLoadedStatus;
import org.jni_zero.SampleForTests;

@CheckDiscard("crbug.com/993421")
public class SampleForTestsJni implements SampleForTests.Natives {
  private static SampleForTests.Natives testInstance;

  public static final JniStaticTestMocker<SampleForTests.Natives> TEST_HOOKS =
      new JniStaticTestMocker<SampleForTests.Natives>() {
    @Override
    public void setInstanceForTesting(SampleForTests.Natives instance) {
      if (!GEN_JNI.TESTING_ENABLED) {
        throw new RuntimeException(
            "Tried to set a JNI mock when mocks aren't enabled!");
      }
      testInstance = instance;
    }
  };

  @Override
  public void addStructB(long nativeCPPClass, SampleForTests caller, SampleForTests.InnerStructB b) {
    assert nativeCPPClass != 0;
    GEN_JNI.org_jni_1zero_SampleForTests_addStructB(nativeCPPClass, caller, b);
  }

  @Override
  public void destroy(long nativeCPPClass, SampleForTests caller, byte[] bytes) {
    assert nativeCPPClass != 0;
    GEN_JNI.org_jni_1zero_SampleForTests_destroy(nativeCPPClass, caller, bytes);
  }

  @Override
  public Class getClass(Class arg0) {
    return (Class) GEN_JNI.org_jni_1zero_SampleForTests_getClass(arg0);
  }

  @Override
  public double getDoubleFunction(SampleForTests caller) {
    return (double) GEN_JNI.org_jni_1zero_SampleForTests_getDoubleFunction(caller);
  }

  @Override
  public float getFloatFunction() {
    return (float) GEN_JNI.org_jni_1zero_SampleForTests_getFloatFunction();
  }

  @Override
  public Map getMap(Map arg0) {
    return (Map) GEN_JNI.org_jni_1zero_SampleForTests_getMap(arg0);
  }

  @Override
  public Object getNonPODDatatype(SampleForTests caller) {
    return (Object) GEN_JNI.org_jni_1zero_SampleForTests_getNonPODDatatype(caller);
  }

  @Override
  public Throwable getThrowable(Throwable arg0) {
    return (Throwable) GEN_JNI.org_jni_1zero_SampleForTests_getThrowable(arg0);
  }

  @Override
  public long init(SampleForTests caller, String param, byte[] bytes, SampleForTests convertedType) {
    return (long) GEN_JNI.org_jni_1zero_SampleForTests_init(caller, param, bytes, convertedType);
  }

  @Override
  public void iterateAndDoSomethingWithStructB(long nativeCPPClass, SampleForTests caller) {
    assert nativeCPPClass != 0;
    GEN_JNI.org_jni_1zero_SampleForTests_iterateAndDoSomethingWithStructB(nativeCPPClass, caller);
  }

  @Override
  public int method(long nativeCPPClass, SampleForTests caller, String[] strings) {
    assert nativeCPPClass != 0;
    return (int) GEN_JNI.org_jni_1zero_SampleForTests_method(nativeCPPClass, caller, strings);
  }

  @Override
  public double methodOtherP0(long nativePtr, SampleForTests caller) {
    assert nativePtr != 0;
    return (double) GEN_JNI.org_jni_1zero_SampleForTests_methodOtherP0(nativePtr, caller);
  }

  @Override
  public String returnAString(long nativeCPPClass, SampleForTests caller) {
    assert nativeCPPClass != 0;
    return (String) GEN_JNI.org_jni_1zero_SampleForTests_returnAString(nativeCPPClass, caller);
  }

  @Override
  public void setNonPODDatatype(SampleForTests caller, Rect rect) {
    GEN_JNI.org_jni_1zero_SampleForTests_setNonPODDatatype(caller, rect);
  }

  public static SampleForTests.Natives get() {
    if (GEN_JNI.TESTING_ENABLED) {
      if (testInstance != null) {
        return testInstance;
      }
      if (GEN_JNI.REQUIRE_MOCK) {
        throw new UnsupportedOperationException(
            "No mock found for the native implementation of SampleForTests.Natives. "
            + "The current configuration requires implementations be mocked.");
      }
    }
    NativeLibraryLoadedStatus.checkLoaded();
    return new SampleForTestsJni();
  }
}
