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

#pragma once

#if __has_include(<NitroModules/JSIConverter.hpp>)
#include <NitroModules/JSIConverter.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif
#if __has_include(<NitroModules/NitroDefines.hpp>)
#include <NitroModules/NitroDefines.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif
#if __has_include(<NitroModules/JSIHelpers.hpp>)
#include <NitroModules/JSIHelpers.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
#include <NitroModules/PropNameIDCache.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif



#include <string>
#include <optional>

namespace margelo::nitro::one {

  /**
   * A struct which can be represented as a JavaScript object (AudioPlayerStatus).
   */
  struct AudioPlayerStatus final {
  public:
    double currentTime     SWIFT_PRIVATE;
    double duration     SWIFT_PRIVATE;
    bool playing     SWIFT_PRIVATE;
    bool paused     SWIFT_PRIVATE;
    bool isLoaded     SWIFT_PRIVATE;
    bool isBuffering     SWIFT_PRIVATE;
    bool loop     SWIFT_PRIVATE;
    bool muted     SWIFT_PRIVATE;
    double volume     SWIFT_PRIVATE;
    double playbackRate     SWIFT_PRIVATE;
    bool shouldCorrectPitch     SWIFT_PRIVATE;
    std::optional<std::string> error     SWIFT_PRIVATE;
    bool didJustFinish     SWIFT_PRIVATE;

  public:
    AudioPlayerStatus() = default;
    explicit AudioPlayerStatus(double currentTime, double duration, bool playing, bool paused, bool isLoaded, bool isBuffering, bool loop, bool muted, double volume, double playbackRate, bool shouldCorrectPitch, std::optional<std::string> error, bool didJustFinish): currentTime(currentTime), duration(duration), playing(playing), paused(paused), isLoaded(isLoaded), isBuffering(isBuffering), loop(loop), muted(muted), volume(volume), playbackRate(playbackRate), shouldCorrectPitch(shouldCorrectPitch), error(error), didJustFinish(didJustFinish) {}

  public:
    friend bool operator==(const AudioPlayerStatus& lhs, const AudioPlayerStatus& rhs) = default;
  };

} // namespace margelo::nitro::one

namespace margelo::nitro {

  // C++ AudioPlayerStatus <> JS AudioPlayerStatus (object)
  template <>
  struct JSIConverter<margelo::nitro::one::AudioPlayerStatus> final {
    static inline margelo::nitro::one::AudioPlayerStatus fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::one::AudioPlayerStatus(
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currentTime"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "playing"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "paused"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isLoaded"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isBuffering"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "loop"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "muted"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "volume"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "playbackRate"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "shouldCorrectPitch"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "error"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "didJustFinish")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::one::AudioPlayerStatus& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "currentTime"), JSIConverter<double>::toJSI(runtime, arg.currentTime));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "duration"), JSIConverter<double>::toJSI(runtime, arg.duration));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "playing"), JSIConverter<bool>::toJSI(runtime, arg.playing));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "paused"), JSIConverter<bool>::toJSI(runtime, arg.paused));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "isLoaded"), JSIConverter<bool>::toJSI(runtime, arg.isLoaded));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "isBuffering"), JSIConverter<bool>::toJSI(runtime, arg.isBuffering));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "loop"), JSIConverter<bool>::toJSI(runtime, arg.loop));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "muted"), JSIConverter<bool>::toJSI(runtime, arg.muted));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "volume"), JSIConverter<double>::toJSI(runtime, arg.volume));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "playbackRate"), JSIConverter<double>::toJSI(runtime, arg.playbackRate));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "shouldCorrectPitch"), JSIConverter<bool>::toJSI(runtime, arg.shouldCorrectPitch));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "error"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.error));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "didJustFinish"), JSIConverter<bool>::toJSI(runtime, arg.didJustFinish));
      return obj;
    }
    static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
      if (!value.isObject()) {
        return false;
      }
      jsi::Object obj = value.getObject(runtime);
      if (!nitro::isPlainObject(runtime, obj)) {
        return false;
      }
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "currentTime")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "playing")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "paused")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isLoaded")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isBuffering")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "loop")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "muted")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "volume")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "playbackRate")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "shouldCorrectPitch")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "error")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "didJustFinish")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
