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

#pragma once

#include "HybridOneLocalAuthenticationSpec.hpp"

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

// Forward declaration of `LocalAuthenticationStatus` to properly resolve imports.
namespace margelo::nitro::one { struct LocalAuthenticationStatus; }
// Forward declaration of `LocalBiometryType` to properly resolve imports.
namespace margelo::nitro::one { enum class LocalBiometryType; }

#include "LocalAuthenticationStatus.hpp"
#include "LocalBiometryType.hpp"
#include <optional>
#include <NitroModules/Promise.hpp>
#include <string>

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

namespace margelo::nitro::one {

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

  public:
    // Get the Swift part
    inline One::HybridOneLocalAuthenticationSpec_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<HybridOneLocalAuthenticationSpecSwift>(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 LocalAuthenticationStatus canEvaluatePolicy() override {
      auto __result = _swiftPart.canEvaluatePolicy();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<bool>> evaluatePolicy(const std::string& reason) override {
      auto __result = _swiftPart.evaluatePolicy(reason);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    One::HybridOneLocalAuthenticationSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::one
