///
/// JTimeRange.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///

#pragma once

#include <fbjni/fbjni.h>
#include "TimeRange.hpp"



namespace margelo::nitro::videopipeline {

  using namespace facebook;

  /**
   * The C++ JNI bridge between the C++ struct "TimeRange" and the the Kotlin data class "TimeRange".
   */
  struct JTimeRange final: public jni::JavaClass<JTimeRange> {
  public:
    static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/videopipeline/TimeRange;";

  public:
    /**
     * Convert this Java/Kotlin-based struct to the C++ struct TimeRange by copying all values to C++.
     */
    [[maybe_unused]]
    [[nodiscard]]
    TimeRange toCpp() const {
      static const auto clazz = javaClassStatic();
      static const auto fieldStartSec = clazz->getField<double>("startSec");
      double startSec = this->getFieldValue(fieldStartSec);
      static const auto fieldEndSec = clazz->getField<double>("endSec");
      double endSec = this->getFieldValue(fieldEndSec);
      return TimeRange(
        startSec,
        endSec
      );
    }

  public:
    /**
     * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
     */
    [[maybe_unused]]
    static jni::local_ref<JTimeRange::javaobject> fromCpp(const TimeRange& value) {
      using JSignature = JTimeRange(double, double);
      static const auto clazz = javaClassStatic();
      static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
      return create(
        clazz,
        value.startSec,
        value.endSec
      );
    }
  };

} // namespace margelo::nitro::videopipeline
