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

#pragma once

#include "HybridAdsControllerSpec.hpp"

// Forward declaration of `HybridAdsControllerSpec_cxx` to properly resolve imports.
namespace Aviation { class HybridAdsControllerSpec_cxx; }

// Forward declaration of `AdBreakInfo` to properly resolve imports.
namespace margelo::nitro::aviation { struct AdBreakInfo; }
// Forward declaration of `AdInfo` to properly resolve imports.
namespace margelo::nitro::aviation { struct AdInfo; }
// Forward declaration of `AdsConfig` to properly resolve imports.
namespace margelo::nitro::aviation { struct AdsConfig; }
// Forward declaration of `CuePoint` to properly resolve imports.
namespace margelo::nitro::aviation { struct CuePoint; }

#include "AdBreakInfo.hpp"
#include <optional>
#include "AdInfo.hpp"
#include <string>
#include "AdsConfig.hpp"
#include "CuePoint.hpp"
#include <vector>
#include <NitroModules/Promise.hpp>
#include <functional>

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

namespace margelo::nitro::aviation {

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

  public:
    // Get the Swift part
    inline Aviation::HybridAdsControllerSpec_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<HybridAdsControllerSpecSwift>(other)) {
        return _swiftPart.equals(otherCast->_swiftPart);
      }
      return false;
    }
    void dispose() noexcept override {
      _swiftPart.dispose();
    }
    std::string toString() override {
      return _swiftPart.toString();
    }

  public:
    // Properties
    inline bool getIsPlayingAd() noexcept override {
      return _swiftPart.isPlayingAd();
    }
    inline std::optional<AdBreakInfo> getCurrentAdBreakInfo() noexcept override {
      auto __result = _swiftPart.getCurrentAdBreakInfo();
      return __result;
    }
    inline std::optional<AdInfo> getCurrentAdInfo() noexcept override {
      auto __result = _swiftPart.getCurrentAdInfo();
      return __result;
    }

  public:
    // Methods
    inline void configure(const AdsConfig& config) override {
      auto __result = _swiftPart.configure(std::forward<decltype(config)>(config));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void setAdTagUrl(const std::string& url) override {
      auto __result = _swiftPart.setAdTagUrl(url);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void addCuePoint(double timeMs, const std::string& adTagUrl) override {
      auto __result = _swiftPart.addCuePoint(std::forward<decltype(timeMs)>(timeMs), adTagUrl);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void removeCuePoint(double timeMs) override {
      auto __result = _swiftPart.removeCuePoint(std::forward<decltype(timeMs)>(timeMs));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void clearCuePoints() override {
      auto __result = _swiftPart.clearCuePoints();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline std::shared_ptr<Promise<void>> requestAd(const std::string& adTagUrl) override {
      auto __result = _swiftPart.requestAd(adTagUrl);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline void skipAd() override {
      auto __result = _swiftPart.skipAd();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void pauseAd() override {
      auto __result = _swiftPart.pauseAd();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void resumeAd() override {
      auto __result = _swiftPart.resumeAd();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void onAdBreakStarted(const std::function<void(const AdBreakInfo& /* info */)>& callback) override {
      auto __result = _swiftPart.onAdBreakStarted(callback);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void onAdBreakEnded(const std::function<void(const AdBreakInfo& /* info */)>& callback) override {
      auto __result = _swiftPart.onAdBreakEnded(callback);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void onAdStarted(const std::function<void(const AdInfo& /* info */)>& callback) override {
      auto __result = _swiftPart.onAdStarted(callback);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void onAdCompleted(const std::function<void(const AdInfo& /* info */)>& callback) override {
      auto __result = _swiftPart.onAdCompleted(callback);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void onAdProgress(const std::function<void(const AdInfo& /* info */)>& callback) override {
      auto __result = _swiftPart.onAdProgress(callback);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void onAdSkipped(const std::function<void(const AdInfo& /* info */)>& callback) override {
      auto __result = _swiftPart.onAdSkipped(callback);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void onAdTapped(const std::function<void(const AdInfo& /* info */)>& callback) override {
      auto __result = _swiftPart.onAdTapped(callback);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void onAdError(const std::function<void(const std::string& /* error */)>& callback) override {
      auto __result = _swiftPart.onAdError(callback);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void onAllAdsCompleted(const std::function<void()>& callback) override {
      auto __result = _swiftPart.onAllAdsCompleted(callback);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline void release() override {
      auto __result = _swiftPart.release();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }

  private:
    Aviation::HybridAdsControllerSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::aviation
