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

#pragma once

#include "HybridAppleAuthSpec.hpp"

// Forward declaration of `HybridAppleAuthSpec_cxx` to properly resolve imports.
namespace AppleAuth { class HybridAppleAuthSpec_cxx; }

// Forward declaration of `AppleAuthCredential` to properly resolve imports.
namespace margelo::nitro::appleauth { struct AppleAuthCredential; }
// Forward declaration of `AppleAuthOptions` to properly resolve imports.
namespace margelo::nitro::appleauth { struct AppleAuthOptions; }
// Forward declaration of `AppleAuthOperation` to properly resolve imports.
namespace margelo::nitro::appleauth { enum class AppleAuthOperation; }
// Forward declaration of `AppleAuthScopes` to properly resolve imports.
namespace margelo::nitro::appleauth { enum class AppleAuthScopes; }

#include <NitroModules/Promise.hpp>
#include <optional>
#include "AppleAuthCredential.hpp"
#include <string>
#include "AppleAuthOptions.hpp"
#include "AppleAuthOperation.hpp"
#include <vector>
#include "AppleAuthScopes.hpp"

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

namespace margelo::nitro::appleauth {

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

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

  public:
    // Get memory pressure
    inline size_t getExternalMemorySize() noexcept override {
      return _swiftPart.getMemorySize();
    }

  public:
    // Properties
    

  public:
    // Methods
    inline std::shared_ptr<Promise<std::optional<AppleAuthCredential>>> signIn(const AppleAuthOptions& options) override {
      auto __result = _swiftPart.signIn(options);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    AppleAuth::HybridAppleAuthSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::appleauth
