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

#pragma once

#include "HybridReactNativeSecureKeySpec.hpp"

// Forward declaration of `HybridReactNativeSecureKeySpec_cxx` to properly resolve imports.
namespace ReactNativeSecureKey { class HybridReactNativeSecureKeySpec_cxx; }



#include <string>

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

namespace margelo::nitro::silencelaboratories_reactnativesecurekey {

  /**
   * The C++ part of HybridReactNativeSecureKeySpec_cxx.swift.
   *
   * HybridReactNativeSecureKeySpecSwift (C++) accesses HybridReactNativeSecureKeySpec_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, HybridReactNativeSecureKeySpec_cxx can directly inherit from the C++ class HybridReactNativeSecureKeySpec
   * to simplify the whole structure and memory management.
   */
  class HybridReactNativeSecureKeySpecSwift: public virtual HybridReactNativeSecureKeySpec {
  public:
    // Constructor from a Swift instance
    explicit HybridReactNativeSecureKeySpecSwift(const ReactNativeSecureKey::HybridReactNativeSecureKeySpec_cxx& swiftPart):
      HybridObject(HybridReactNativeSecureKeySpec::TAG),
      _swiftPart(swiftPart) { }

  public:
    // Get the Swift part
    inline ReactNativeSecureKey::HybridReactNativeSecureKeySpec_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<HybridReactNativeSecureKeySpecSwift>(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::string generateKeyPair(const std::string& alias) override {
      auto __result = _swiftPart.generateKeyPair(alias);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::string getKey(const std::string& alias) override {
      auto __result = _swiftPart.getKey(alias);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline bool isKeyExist(const std::string& alias) override {
      auto __result = _swiftPart.isKeyExist(alias);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline bool deleteSecureKey(const std::string& alias) override {
      auto __result = _swiftPart.deleteSecureKey(alias);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::string sign(const std::string& alias, const std::string& message) override {
      auto __result = _swiftPart.sign(alias, message);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline bool verify(const std::string& alias, const std::string& signature, const std::string& message) override {
      auto __result = _swiftPart.verify(alias, signature, message);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    ReactNativeSecureKey::HybridReactNativeSecureKeySpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::silencelaboratories_reactnativesecurekey
