///
/// DomainEvent.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

// Forward declaration of `DomainEventType` to properly resolve imports.
namespace margelo::nitro::aviation { enum class DomainEventType; }
// Forward declaration of `PlaybackState` to properly resolve imports.
namespace margelo::nitro::aviation { enum class PlaybackState; }
// Forward declaration of `MediaPosition` to properly resolve imports.
namespace margelo::nitro::aviation { struct MediaPosition; }
// Forward declaration of `ItemSource` to properly resolve imports.
namespace margelo::nitro::aviation { enum class ItemSource; }
// Forward declaration of `TtffSource` to properly resolve imports.
namespace margelo::nitro::aviation { enum class TtffSource; }
// Forward declaration of `AviationInterruptionMode` to properly resolve imports.
namespace margelo::nitro::aviation { enum class AviationInterruptionMode; }

#include "DomainEventType.hpp"
#include <optional>
#include "PlaybackState.hpp"
#include "MediaPosition.hpp"
#include "ItemSource.hpp"
#include <string>
#include "TtffSource.hpp"
#include "AviationInterruptionMode.hpp"

namespace margelo::nitro::aviation {

  /**
   * A struct which can be represented as a JavaScript object (DomainEvent).
   */
  struct DomainEvent final {
  public:
    DomainEventType type     SWIFT_PRIVATE;
    std::optional<double> queueIndex     SWIFT_PRIVATE;
    std::optional<PlaybackState> oldState     SWIFT_PRIVATE;
    std::optional<PlaybackState> newState     SWIFT_PRIVATE;
    std::optional<MediaPosition> position     SWIFT_PRIVATE;
    std::optional<ItemSource> itemSource     SWIFT_PRIVATE;
    std::optional<std::string> errorMessage     SWIFT_PRIVATE;
    std::optional<std::string> errorCode     SWIFT_PRIVATE;
    std::optional<double> rate     SWIFT_PRIVATE;
    std::optional<double> volume     SWIFT_PRIVATE;
    std::optional<bool> muted     SWIFT_PRIVATE;
    std::optional<std::string> uri     SWIFT_PRIVATE;
    std::optional<double> bytes     SWIFT_PRIVATE;
    std::optional<double> layer     SWIFT_PRIVATE;
    std::optional<double> durationMs     SWIFT_PRIVATE;
    std::optional<TtffSource> source     SWIFT_PRIVATE;
    std::optional<std::string> error     SWIFT_PRIVATE;
    std::optional<double> videoBitrateBps     SWIFT_PRIVATE;
    std::optional<double> audioBitrateBps     SWIFT_PRIVATE;
    std::optional<double> adBreakIndex     SWIFT_PRIVATE;
    std::optional<double> adBreakTimeMs     SWIFT_PRIVATE;
    std::optional<double> totalAdsInBreak     SWIFT_PRIVATE;
    std::optional<std::string> adId     SWIFT_PRIVATE;
    std::optional<std::string> adTitle     SWIFT_PRIVATE;
    std::optional<double> adDurationMs     SWIFT_PRIVATE;
    std::optional<double> adCurrentMs     SWIFT_PRIVATE;
    std::optional<double> adIndexInBreak     SWIFT_PRIVATE;
    std::optional<bool> isSkippable     SWIFT_PRIVATE;
    std::optional<double> skipOffsetMs     SWIFT_PRIVATE;
    std::optional<bool> began     SWIFT_PRIVATE;
    std::optional<bool> shouldResume     SWIFT_PRIVATE;
    std::optional<AviationInterruptionMode> resumePolicy     SWIFT_PRIVATE;

  public:
    DomainEvent() = default;
    explicit DomainEvent(DomainEventType type, std::optional<double> queueIndex, std::optional<PlaybackState> oldState, std::optional<PlaybackState> newState, std::optional<MediaPosition> position, std::optional<ItemSource> itemSource, std::optional<std::string> errorMessage, std::optional<std::string> errorCode, std::optional<double> rate, std::optional<double> volume, std::optional<bool> muted, std::optional<std::string> uri, std::optional<double> bytes, std::optional<double> layer, std::optional<double> durationMs, std::optional<TtffSource> source, std::optional<std::string> error, std::optional<double> videoBitrateBps, std::optional<double> audioBitrateBps, std::optional<double> adBreakIndex, std::optional<double> adBreakTimeMs, std::optional<double> totalAdsInBreak, std::optional<std::string> adId, std::optional<std::string> adTitle, std::optional<double> adDurationMs, std::optional<double> adCurrentMs, std::optional<double> adIndexInBreak, std::optional<bool> isSkippable, std::optional<double> skipOffsetMs, std::optional<bool> began, std::optional<bool> shouldResume, std::optional<AviationInterruptionMode> resumePolicy): type(type), queueIndex(queueIndex), oldState(oldState), newState(newState), position(position), itemSource(itemSource), errorMessage(errorMessage), errorCode(errorCode), rate(rate), volume(volume), muted(muted), uri(uri), bytes(bytes), layer(layer), durationMs(durationMs), source(source), error(error), videoBitrateBps(videoBitrateBps), audioBitrateBps(audioBitrateBps), adBreakIndex(adBreakIndex), adBreakTimeMs(adBreakTimeMs), totalAdsInBreak(totalAdsInBreak), adId(adId), adTitle(adTitle), adDurationMs(adDurationMs), adCurrentMs(adCurrentMs), adIndexInBreak(adIndexInBreak), isSkippable(isSkippable), skipOffsetMs(skipOffsetMs), began(began), shouldResume(shouldResume), resumePolicy(resumePolicy) {}

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

} // namespace margelo::nitro::aviation

namespace margelo::nitro {

  // C++ DomainEvent <> JS DomainEvent (object)
  template <>
  struct JSIConverter<margelo::nitro::aviation::DomainEvent> final {
    static inline margelo::nitro::aviation::DomainEvent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::aviation::DomainEvent(
        JSIConverter<margelo::nitro::aviation::DomainEventType>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "queueIndex"))),
        JSIConverter<std::optional<margelo::nitro::aviation::PlaybackState>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "oldState"))),
        JSIConverter<std::optional<margelo::nitro::aviation::PlaybackState>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "newState"))),
        JSIConverter<std::optional<margelo::nitro::aviation::MediaPosition>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "position"))),
        JSIConverter<std::optional<margelo::nitro::aviation::ItemSource>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "itemSource"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "errorMessage"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "errorCode"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rate"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "volume"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "muted"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uri"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bytes"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "layer"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "durationMs"))),
        JSIConverter<std::optional<margelo::nitro::aviation::TtffSource>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "source"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "error"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "videoBitrateBps"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "audioBitrateBps"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "adBreakIndex"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "adBreakTimeMs"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "totalAdsInBreak"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "adId"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "adTitle"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "adDurationMs"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "adCurrentMs"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "adIndexInBreak"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isSkippable"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "skipOffsetMs"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "began"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "shouldResume"))),
        JSIConverter<std::optional<margelo::nitro::aviation::AviationInterruptionMode>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "resumePolicy")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::aviation::DomainEvent& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<margelo::nitro::aviation::DomainEventType>::toJSI(runtime, arg.type));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "queueIndex"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.queueIndex));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "oldState"), JSIConverter<std::optional<margelo::nitro::aviation::PlaybackState>>::toJSI(runtime, arg.oldState));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "newState"), JSIConverter<std::optional<margelo::nitro::aviation::PlaybackState>>::toJSI(runtime, arg.newState));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "position"), JSIConverter<std::optional<margelo::nitro::aviation::MediaPosition>>::toJSI(runtime, arg.position));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "itemSource"), JSIConverter<std::optional<margelo::nitro::aviation::ItemSource>>::toJSI(runtime, arg.itemSource));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "errorMessage"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.errorMessage));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "errorCode"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.errorCode));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "rate"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.rate));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "volume"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.volume));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "muted"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.muted));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "uri"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.uri));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "bytes"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.bytes));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "layer"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.layer));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "durationMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.durationMs));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "source"), JSIConverter<std::optional<margelo::nitro::aviation::TtffSource>>::toJSI(runtime, arg.source));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "error"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.error));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "videoBitrateBps"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.videoBitrateBps));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "audioBitrateBps"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.audioBitrateBps));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "adBreakIndex"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.adBreakIndex));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "adBreakTimeMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.adBreakTimeMs));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "totalAdsInBreak"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.totalAdsInBreak));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "adId"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.adId));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "adTitle"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.adTitle));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "adDurationMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.adDurationMs));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "adCurrentMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.adCurrentMs));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "adIndexInBreak"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.adIndexInBreak));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "isSkippable"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.isSkippable));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "skipOffsetMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.skipOffsetMs));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "began"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.began));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "shouldResume"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.shouldResume));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "resumePolicy"), JSIConverter<std::optional<margelo::nitro::aviation::AviationInterruptionMode>>::toJSI(runtime, arg.resumePolicy));
      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<margelo::nitro::aviation::DomainEventType>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "queueIndex")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::aviation::PlaybackState>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "oldState")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::aviation::PlaybackState>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "newState")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::aviation::MediaPosition>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "position")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::aviation::ItemSource>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "itemSource")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "errorMessage")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "errorCode")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rate")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "volume")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "muted")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uri")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bytes")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "layer")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "durationMs")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::aviation::TtffSource>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "source")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "error")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "videoBitrateBps")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "audioBitrateBps")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "adBreakIndex")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "adBreakTimeMs")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "totalAdsInBreak")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "adId")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "adTitle")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "adDurationMs")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "adCurrentMs")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "adIndexInBreak")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isSkippable")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "skipOffsetMs")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "began")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "shouldResume")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::aviation::AviationInterruptionMode>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "resumePolicy")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
