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

#pragma once

#include "HybridSensitiveInfoSpec.hpp"

// Forward declaration of `HybridSensitiveInfoSpec_cxx` to properly resolve imports.
namespace SensitiveInfo { class HybridSensitiveInfoSpec_cxx; }

// Forward declaration of `MutationResult` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { struct MutationResult; }
// Forward declaration of `StorageMetadata` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { struct StorageMetadata; }
// Forward declaration of `SecurityLevel` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { enum class SecurityLevel; }
// Forward declaration of `StorageBackend` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { enum class StorageBackend; }
// Forward declaration of `AccessControl` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { enum class AccessControl; }
// Forward declaration of `SensitiveInfoSetRequest` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { struct SensitiveInfoSetRequest; }
// Forward declaration of `AuthenticationPrompt` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { struct AuthenticationPrompt; }
// Forward declaration of `SensitiveInfoItem` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { struct SensitiveInfoItem; }
// Forward declaration of `SensitiveInfoGetRequest` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { struct SensitiveInfoGetRequest; }
// Forward declaration of `SensitiveInfoDeleteRequest` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { struct SensitiveInfoDeleteRequest; }
// Forward declaration of `SensitiveInfoHasRequest` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { struct SensitiveInfoHasRequest; }
// Forward declaration of `SensitiveInfoEnumerateRequest` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { struct SensitiveInfoEnumerateRequest; }
// Forward declaration of `SensitiveInfoOptions` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { struct SensitiveInfoOptions; }
// Forward declaration of `SecurityAvailability` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { struct SecurityAvailability; }
// Forward declaration of `BiometryStatus` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { enum class BiometryStatus; }
// Forward declaration of `RotationResult` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { struct RotationResult; }
// Forward declaration of `RotateKeysRequest` to properly resolve imports.
namespace margelo::nitro::sensitiveinfo { struct RotateKeysRequest; }

#include "MutationResult.hpp"
#include <NitroModules/Promise.hpp>
#include "StorageMetadata.hpp"
#include "SecurityLevel.hpp"
#include "StorageBackend.hpp"
#include "AccessControl.hpp"
#include <optional>
#include <string>
#include "SensitiveInfoSetRequest.hpp"
#include "AuthenticationPrompt.hpp"
#include <NitroModules/Null.hpp>
#include "SensitiveInfoItem.hpp"
#include <variant>
#include "SensitiveInfoGetRequest.hpp"
#include "SensitiveInfoDeleteRequest.hpp"
#include "SensitiveInfoHasRequest.hpp"
#include <vector>
#include "SensitiveInfoEnumerateRequest.hpp"
#include "SensitiveInfoOptions.hpp"
#include "SecurityAvailability.hpp"
#include "BiometryStatus.hpp"
#include "RotationResult.hpp"
#include "RotateKeysRequest.hpp"

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

namespace margelo::nitro::sensitiveinfo {

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

  public:
    // Get the Swift part
    inline SensitiveInfo::HybridSensitiveInfoSpec_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<HybridSensitiveInfoSpecSwift>(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<MutationResult>> setItem(const SensitiveInfoSetRequest& request) override {
      auto __result = _swiftPart.setItem(std::forward<decltype(request)>(request));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<std::variant<nitro::NullType, SensitiveInfoItem>>> getItem(const SensitiveInfoGetRequest& request) override {
      auto __result = _swiftPart.getItem(std::forward<decltype(request)>(request));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<bool>> deleteItem(const SensitiveInfoDeleteRequest& request) override {
      auto __result = _swiftPart.deleteItem(std::forward<decltype(request)>(request));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<bool>> hasItem(const SensitiveInfoHasRequest& request) override {
      auto __result = _swiftPart.hasItem(std::forward<decltype(request)>(request));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<std::vector<SensitiveInfoItem>>> getAllItems(const std::optional<SensitiveInfoEnumerateRequest>& request) override {
      auto __result = _swiftPart.getAllItems(request);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<void>> clearService(const std::optional<SensitiveInfoOptions>& request) override {
      auto __result = _swiftPart.clearService(request);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<SecurityAvailability>> getSupportedSecurityLevels() override {
      auto __result = _swiftPart.getSupportedSecurityLevels();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<RotationResult>> rotateKeys(const std::optional<RotateKeysRequest>& request) override {
      auto __result = _swiftPart.rotateKeys(request);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<double>> getKeyVersion(const std::optional<SensitiveInfoOptions>& request) override {
      auto __result = _swiftPart.getKeyVersion(request);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    SensitiveInfo::HybridSensitiveInfoSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::sensitiveinfo
