///
/// LinkedAccountDetails.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 `ActiveLinkedAccountDetails` to properly resolve imports.
namespace margelo::nitro::rncandle { struct ActiveLinkedAccountDetails; }
// Forward declaration of `InactiveLinkedAccountDetails` to properly resolve imports.
namespace margelo::nitro::rncandle { struct InactiveLinkedAccountDetails; }
// Forward declaration of `UnavailableLinkedAccountDetails` to properly resolve imports.
namespace margelo::nitro::rncandle { struct UnavailableLinkedAccountDetails; }

#include "ActiveLinkedAccountDetails.hpp"
#include <optional>
#include "InactiveLinkedAccountDetails.hpp"
#include "UnavailableLinkedAccountDetails.hpp"

namespace margelo::nitro::rncandle {

  /**
   * A struct which can be represented as a JavaScript object (LinkedAccountDetails).
   */
  struct LinkedAccountDetails {
  public:
    std::optional<ActiveLinkedAccountDetails> activeLinkedAccountDetails     SWIFT_PRIVATE;
    std::optional<InactiveLinkedAccountDetails> inactiveLinkedAccountDetails     SWIFT_PRIVATE;
    std::optional<UnavailableLinkedAccountDetails> unavailableLinkedAccountDetails     SWIFT_PRIVATE;

  public:
    LinkedAccountDetails() = default;
    explicit LinkedAccountDetails(std::optional<ActiveLinkedAccountDetails> activeLinkedAccountDetails, std::optional<InactiveLinkedAccountDetails> inactiveLinkedAccountDetails, std::optional<UnavailableLinkedAccountDetails> unavailableLinkedAccountDetails): activeLinkedAccountDetails(activeLinkedAccountDetails), inactiveLinkedAccountDetails(inactiveLinkedAccountDetails), unavailableLinkedAccountDetails(unavailableLinkedAccountDetails) {}
  };

} // namespace margelo::nitro::rncandle

namespace margelo::nitro {

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

} // namespace margelo::nitro
