///
/// NitroLaunchExternalLinkParamsAndroid.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 `BillingProgramAndroid` to properly resolve imports.
namespace margelo::nitro::iap { enum class BillingProgramAndroid; }
// Forward declaration of `ExternalLinkLaunchModeAndroid` to properly resolve imports.
namespace margelo::nitro::iap { enum class ExternalLinkLaunchModeAndroid; }
// Forward declaration of `ExternalLinkTypeAndroid` to properly resolve imports.
namespace margelo::nitro::iap { enum class ExternalLinkTypeAndroid; }

#include "BillingProgramAndroid.hpp"
#include "ExternalLinkLaunchModeAndroid.hpp"
#include "ExternalLinkTypeAndroid.hpp"
#include <string>

namespace margelo::nitro::iap {

  /**
   * A struct which can be represented as a JavaScript object (NitroLaunchExternalLinkParamsAndroid).
   */
  struct NitroLaunchExternalLinkParamsAndroid final {
  public:
    BillingProgramAndroid billingProgram     SWIFT_PRIVATE;
    ExternalLinkLaunchModeAndroid launchMode     SWIFT_PRIVATE;
    ExternalLinkTypeAndroid linkType     SWIFT_PRIVATE;
    std::string linkUri     SWIFT_PRIVATE;

  public:
    NitroLaunchExternalLinkParamsAndroid() = default;
    explicit NitroLaunchExternalLinkParamsAndroid(BillingProgramAndroid billingProgram, ExternalLinkLaunchModeAndroid launchMode, ExternalLinkTypeAndroid linkType, std::string linkUri): billingProgram(billingProgram), launchMode(launchMode), linkType(linkType), linkUri(linkUri) {}

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

} // namespace margelo::nitro::iap

namespace margelo::nitro {

  // C++ NitroLaunchExternalLinkParamsAndroid <> JS NitroLaunchExternalLinkParamsAndroid (object)
  template <>
  struct JSIConverter<margelo::nitro::iap::NitroLaunchExternalLinkParamsAndroid> final {
    static inline margelo::nitro::iap::NitroLaunchExternalLinkParamsAndroid fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::iap::NitroLaunchExternalLinkParamsAndroid(
        JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "billingProgram"))),
        JSIConverter<margelo::nitro::iap::ExternalLinkLaunchModeAndroid>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "launchMode"))),
        JSIConverter<margelo::nitro::iap::ExternalLinkTypeAndroid>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "linkType"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "linkUri")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::iap::NitroLaunchExternalLinkParamsAndroid& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "billingProgram"), JSIConverter<margelo::nitro::iap::BillingProgramAndroid>::toJSI(runtime, arg.billingProgram));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "launchMode"), JSIConverter<margelo::nitro::iap::ExternalLinkLaunchModeAndroid>::toJSI(runtime, arg.launchMode));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "linkType"), JSIConverter<margelo::nitro::iap::ExternalLinkTypeAndroid>::toJSI(runtime, arg.linkType));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "linkUri"), JSIConverter<std::string>::toJSI(runtime, arg.linkUri));
      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::iap::BillingProgramAndroid>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "billingProgram")))) return false;
      if (!JSIConverter<margelo::nitro::iap::ExternalLinkLaunchModeAndroid>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "launchMode")))) return false;
      if (!JSIConverter<margelo::nitro::iap::ExternalLinkTypeAndroid>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "linkType")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "linkUri")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
