///
/// NitroInAppBrowserOptions.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 `NitroInAppBrowserDismissButtonLabel` to properly resolve imports.
namespace margelo::nitro::nitroinappbrowser { enum class NitroInAppBrowserDismissButtonLabel; }
// Forward declaration of `NitroInAppBrowserPresentationStyle` to properly resolve imports.
namespace margelo::nitro::nitroinappbrowser { enum class NitroInAppBrowserPresentationStyle; }

#include "NitroInAppBrowserDismissButtonLabel.hpp"
#include <optional>
#include "NitroInAppBrowserPresentationStyle.hpp"
#include <string>

namespace margelo::nitro::nitroinappbrowser {

  /**
   * A struct which can be represented as a JavaScript object (NitroInAppBrowserOptions).
   */
  struct NitroInAppBrowserOptions final {
  public:
    std::optional<NitroInAppBrowserDismissButtonLabel> dismissButtonLabel     SWIFT_PRIVATE;
    std::optional<NitroInAppBrowserPresentationStyle> presentationStyle     SWIFT_PRIVATE;
    std::optional<std::string> barColor     SWIFT_PRIVATE;
    std::optional<std::string> controlColor     SWIFT_PRIVATE;

  public:
    NitroInAppBrowserOptions() = default;
    explicit NitroInAppBrowserOptions(std::optional<NitroInAppBrowserDismissButtonLabel> dismissButtonLabel, std::optional<NitroInAppBrowserPresentationStyle> presentationStyle, std::optional<std::string> barColor, std::optional<std::string> controlColor): dismissButtonLabel(dismissButtonLabel), presentationStyle(presentationStyle), barColor(barColor), controlColor(controlColor) {}

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

} // namespace margelo::nitro::nitroinappbrowser

namespace margelo::nitro {

  // C++ NitroInAppBrowserOptions <> JS NitroInAppBrowserOptions (object)
  template <>
  struct JSIConverter<margelo::nitro::nitroinappbrowser::NitroInAppBrowserOptions> final {
    static inline margelo::nitro::nitroinappbrowser::NitroInAppBrowserOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::nitroinappbrowser::NitroInAppBrowserOptions(
        JSIConverter<std::optional<margelo::nitro::nitroinappbrowser::NitroInAppBrowserDismissButtonLabel>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "dismissButtonLabel"))),
        JSIConverter<std::optional<margelo::nitro::nitroinappbrowser::NitroInAppBrowserPresentationStyle>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "presentationStyle"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "barColor"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "controlColor")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroinappbrowser::NitroInAppBrowserOptions& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "dismissButtonLabel"), JSIConverter<std::optional<margelo::nitro::nitroinappbrowser::NitroInAppBrowserDismissButtonLabel>>::toJSI(runtime, arg.dismissButtonLabel));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "presentationStyle"), JSIConverter<std::optional<margelo::nitro::nitroinappbrowser::NitroInAppBrowserPresentationStyle>>::toJSI(runtime, arg.presentationStyle));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "barColor"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.barColor));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "controlColor"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.controlColor));
      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<std::optional<margelo::nitro::nitroinappbrowser::NitroInAppBrowserDismissButtonLabel>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "dismissButtonLabel")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::nitroinappbrowser::NitroInAppBrowserPresentationStyle>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "presentationStyle")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "barColor")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "controlColor")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
