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

#include "JHybridMediaItemSpec.hpp"

// Forward declaration of `MediaType` to properly resolve imports.
namespace margelo::nitro::aviation { enum class MediaType; }
// Forward declaration of `DrmType` to properly resolve imports.
namespace margelo::nitro::aviation { enum class DrmType; }

#include <string>
#include "MediaType.hpp"
#include <optional>
#include "JMediaType.hpp"
#include "DrmType.hpp"
#include "JDrmType.hpp"

namespace margelo::nitro::aviation {

  jni::local_ref<JHybridMediaItemSpec::jhybriddata> JHybridMediaItemSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
    return makeCxxInstance(jThis);
  }

  void JHybridMediaItemSpec::registerNatives() {
    registerHybrid({
      makeNativeMethod("initHybrid", JHybridMediaItemSpec::initHybrid),
    });
  }

  size_t JHybridMediaItemSpec::getExternalMemorySize() noexcept {
    static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
    return method(_javaPart);
  }

  bool JHybridMediaItemSpec::equals(const std::shared_ptr<HybridObject>& other) {
    if (auto otherCast = std::dynamic_pointer_cast<JHybridMediaItemSpec>(other)) {
      return _javaPart == otherCast->_javaPart;
    }
    return false;
  }

  void JHybridMediaItemSpec::dispose() noexcept {
    static const auto method = javaClassStatic()->getMethod<void()>("dispose");
    method(_javaPart);
  }

  std::string JHybridMediaItemSpec::toString() {
    static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
    auto javaString = method(_javaPart);
    return javaString->toStdString();
  }

  // Properties
  std::string JHybridMediaItemSpec::getUri() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getUri");
    auto __result = method(_javaPart);
    return __result->toStdString();
  }
  std::optional<MediaType> JHybridMediaItemSpec::getMediaType() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JMediaType>()>("getMediaType");
    auto __result = method(_javaPart);
    return __result != nullptr ? std::make_optional(__result->toCpp()) : std::nullopt;
  }
  std::optional<std::string> JHybridMediaItemSpec::getMimeType() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getMimeType");
    auto __result = method(_javaPart);
    return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
  }
  std::optional<std::string> JHybridMediaItemSpec::getTitle() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getTitle");
    auto __result = method(_javaPart);
    return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
  }
  std::optional<std::string> JHybridMediaItemSpec::getArtist() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getArtist");
    auto __result = method(_javaPart);
    return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
  }
  std::optional<std::string> JHybridMediaItemSpec::getAlbum() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getAlbum");
    auto __result = method(_javaPart);
    return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
  }
  std::optional<std::string> JHybridMediaItemSpec::getArtworkUri() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getArtworkUri");
    auto __result = method(_javaPart);
    return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
  }
  double JHybridMediaItemSpec::getDurationMs() {
    static const auto method = javaClassStatic()->getMethod<double()>("getDurationMs");
    auto __result = method(_javaPart);
    return __result;
  }
  bool JHybridMediaItemSpec::getHasDrm() {
    static const auto method = javaClassStatic()->getMethod<jboolean()>("hasDrm");
    auto __result = method(_javaPart);
    return static_cast<bool>(__result);
  }
  std::optional<DrmType> JHybridMediaItemSpec::getDrmType() {
    static const auto method = javaClassStatic()->getMethod<jni::local_ref<JDrmType>()>("getDrmType");
    auto __result = method(_javaPart);
    return __result != nullptr ? std::make_optional(__result->toCpp()) : std::nullopt;
  }

  // Methods
  

} // namespace margelo::nitro::aviation
