///
/// NitroInAppBrowserOptions.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © 2025 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

// Forward declaration of `NitroInAppBrowserDismissButtonLabel` to properly resolve imports.
namespace margelo::nitro::nitroinappbrowser { enum class NitroInAppBrowserDismissButtonLabel; }

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

namespace margelo::nitro::nitroinappbrowser {

  /**
   * A struct which can be represented as a JavaScript object (NitroInAppBrowserOptions).
   */
  struct NitroInAppBrowserOptions {
  public:
    std::optional<NitroInAppBrowserDismissButtonLabel> dismissButtonLabel     SWIFT_PRIVATE;
    std::optional<std::string> 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<std::string> presentationStyle, std::optional<std::string> barColor, std::optional<std::string> controlColor): dismissButtonLabel(dismissButtonLabel), presentationStyle(presentationStyle), barColor(barColor), controlColor(controlColor) {}
  };

} // namespace margelo::nitro::nitroinappbrowser

namespace margelo::nitro {

  using namespace margelo::nitro::nitroinappbrowser;

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

} // namespace margelo::nitro
