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



#include <string>
#include <optional>

namespace margelo::nitro::rncandle {

  /**
   * A struct which can be represented as a JavaScript object (ActiveLinkedAccountDetails).
   */
  struct ActiveLinkedAccountDetails {
  public:
    std::string state     SWIFT_PRIVATE;
    std::optional<std::string> accountOpened     SWIFT_PRIVATE;
    std::optional<std::string> username     SWIFT_PRIVATE;
    std::optional<std::string> emailAddress     SWIFT_PRIVATE;
    std::string legalName     SWIFT_PRIVATE;

  public:
    ActiveLinkedAccountDetails() = default;
    explicit ActiveLinkedAccountDetails(std::string state, std::optional<std::string> accountOpened, std::optional<std::string> username, std::optional<std::string> emailAddress, std::string legalName): state(state), accountOpened(accountOpened), username(username), emailAddress(emailAddress), legalName(legalName) {}
  };

} // namespace margelo::nitro::rncandle

namespace margelo::nitro {

  // C++ ActiveLinkedAccountDetails <> JS ActiveLinkedAccountDetails (object)
  template <>
  struct JSIConverter<margelo::nitro::rncandle::ActiveLinkedAccountDetails> final {
    static inline margelo::nitro::rncandle::ActiveLinkedAccountDetails fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::rncandle::ActiveLinkedAccountDetails(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "state")),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "accountOpened")),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "username")),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "emailAddress")),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "legalName"))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rncandle::ActiveLinkedAccountDetails& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, "state", JSIConverter<std::string>::toJSI(runtime, arg.state));
      obj.setProperty(runtime, "accountOpened", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.accountOpened));
      obj.setProperty(runtime, "username", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.username));
      obj.setProperty(runtime, "emailAddress", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.emailAddress));
      obj.setProperty(runtime, "legalName", JSIConverter<std::string>::toJSI(runtime, arg.legalName));
      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::string>::canConvert(runtime, obj.getProperty(runtime, "state"))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "accountOpened"))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "username"))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "emailAddress"))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "legalName"))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
