///
/// HybridNativeCNContactStoreSpecSwift.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///

#pragma once

#include "HybridNativeCNContactStoreSpec.hpp"

// Forward declaration of `HybridNativeCNContactStoreSpec_cxx` to properly resolve imports.
namespace One { class HybridNativeCNContactStoreSpec_cxx; }

// Forward declaration of `HybridNativeCNContactSpec` to properly resolve imports.
namespace margelo::nitro::one { class HybridNativeCNContactSpec; }
// Forward declaration of `HybridNativeCNKeyDescriptorSpec` to properly resolve imports.
namespace margelo::nitro::one { class HybridNativeCNKeyDescriptorSpec; }

#include <memory>
#include "HybridNativeCNContactSpec.hpp"
#include <NitroModules/Promise.hpp>
#include <string>
#include <vector>
#include "HybridNativeCNKeyDescriptorSpec.hpp"

#include "One-Swift-Cxx-Umbrella.hpp"

namespace margelo::nitro::one {

  /**
   * The C++ part of HybridNativeCNContactStoreSpec_cxx.swift.
   *
   * HybridNativeCNContactStoreSpecSwift (C++) accesses HybridNativeCNContactStoreSpec_cxx (Swift), and might
   * contain some additional bridging code for C++ <> Swift interop.
   *
   * Since this obviously introduces an overhead, I hope at some point in
   * the future, HybridNativeCNContactStoreSpec_cxx can directly inherit from the C++ class HybridNativeCNContactStoreSpec
   * to simplify the whole structure and memory management.
   */
  class HybridNativeCNContactStoreSpecSwift: public virtual HybridNativeCNContactStoreSpec {
  public:
    // Constructor from a Swift instance
    explicit HybridNativeCNContactStoreSpecSwift(const One::HybridNativeCNContactStoreSpec_cxx& swiftPart):
      HybridObject(HybridNativeCNContactStoreSpec::TAG),
      _swiftPart(swiftPart) { }

  public:
    // Get the Swift part
    inline One::HybridNativeCNContactStoreSpec_cxx& getSwiftPart() noexcept {
      return _swiftPart;
    }

  public:
    inline size_t getExternalMemorySize() noexcept override {
      return _swiftPart.getMemorySize();
    }
    bool equals(const std::shared_ptr<HybridObject>& other) override {
      if (auto otherCast = std::dynamic_pointer_cast<HybridNativeCNContactStoreSpecSwift>(other)) {
        return _swiftPart.equals(otherCast->_swiftPart);
      }
      return false;
    }
    void dispose() noexcept override {
      _swiftPart.dispose();
    }
    std::string toString() override {
      return _swiftPart.toString();
    }

  public:
    // Properties


  public:
    // Methods
    inline std::shared_ptr<Promise<std::shared_ptr<HybridNativeCNContactSpec>>> unifiedContact(const std::string& withIdentifier, const std::vector<std::string>& keys, const std::vector<std::shared_ptr<HybridNativeCNKeyDescriptorSpec>>& descriptors) override {
      auto __result = _swiftPart.unifiedContact(withIdentifier, keys, descriptors);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    One::HybridNativeCNContactStoreSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::one
