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

#pragma once

#include "HybridMediaToolkitSpec.hpp"

// Forward declaration of `HybridMediaToolkitSpec_cxx` to properly resolve imports.
namespace MediaToolkit { class HybridMediaToolkitSpec_cxx; }

// Forward declaration of `MediaResult` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct MediaResult; }
// Forward declaration of `CropOptions` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct CropOptions; }
// Forward declaration of `CompressImageOptions` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct CompressImageOptions; }
// Forward declaration of `SplitImageOptions` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct SplitImageOptions; }
// Forward declaration of `FlipOptions` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct FlipOptions; }
// Forward declaration of `RotateOptions` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct RotateOptions; }
// Forward declaration of `VideoCropOptions` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct VideoCropOptions; }
// Forward declaration of `TrimOptions` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct TrimOptions; }
// Forward declaration of `TrimAndCropOptions` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct TrimAndCropOptions; }
// Forward declaration of `ThumbnailResult` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct ThumbnailResult; }
// Forward declaration of `ThumbnailOptions` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct ThumbnailOptions; }
// Forward declaration of `CompressVideoOptions` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct CompressVideoOptions; }
// Forward declaration of `ProcessVideoOptions` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct ProcessVideoOptions; }
// Forward declaration of `ProcessImageOptions` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct ProcessImageOptions; }
// Forward declaration of `SpeedOptions` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct SpeedOptions; }
// Forward declaration of `ExtractAudioOptions` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct ExtractAudioOptions; }
// Forward declaration of `GeneratePreviewOptions` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct GeneratePreviewOptions; }
// Forward declaration of `ConcatResult` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct ConcatResult; }
// Forward declaration of `MediaMetadata` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct MediaMetadata; }
// Forward declaration of `LocationData` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct LocationData; }

#include "MediaResult.hpp"
#include <NitroModules/Promise.hpp>
#include <string>
#include "CropOptions.hpp"
#include <optional>
#include "CompressImageOptions.hpp"
#include <vector>
#include "SplitImageOptions.hpp"
#include "FlipOptions.hpp"
#include "RotateOptions.hpp"
#include "VideoCropOptions.hpp"
#include "TrimOptions.hpp"
#include "TrimAndCropOptions.hpp"
#include "ThumbnailResult.hpp"
#include "ThumbnailOptions.hpp"
#include "CompressVideoOptions.hpp"
#include "ProcessVideoOptions.hpp"
#include "ProcessImageOptions.hpp"
#include "SpeedOptions.hpp"
#include "ExtractAudioOptions.hpp"
#include "GeneratePreviewOptions.hpp"
#include "ConcatResult.hpp"
#include "MediaMetadata.hpp"
#include "LocationData.hpp"

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

namespace margelo::nitro::mediatoolkit {

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

  public:
    // Get the Swift part
    inline MediaToolkit::HybridMediaToolkitSpec_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<HybridMediaToolkitSpecSwift>(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<MediaResult>> cropImage(const std::string& uri, const CropOptions& options) override {
      auto __result = _swiftPart.cropImage(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MediaResult>> compressImage(const std::string& uri, const CompressImageOptions& options) override {
      auto __result = _swiftPart.compressImage(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<std::vector<MediaResult>>> splitImage(const std::string& uri, const SplitImageOptions& options) override {
      auto __result = _swiftPart.splitImage(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MediaResult>> flipImage(const std::string& uri, const FlipOptions& options) override {
      auto __result = _swiftPart.flipImage(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MediaResult>> rotateImage(const std::string& uri, const RotateOptions& options) override {
      auto __result = _swiftPart.rotateImage(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MediaResult>> cropVideo(const std::string& uri, const VideoCropOptions& options) override {
      auto __result = _swiftPart.cropVideo(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MediaResult>> trimVideo(const std::string& uri, const TrimOptions& options) override {
      auto __result = _swiftPart.trimVideo(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MediaResult>> trimAndCropVideo(const std::string& uri, const TrimAndCropOptions& options) override {
      auto __result = _swiftPart.trimAndCropVideo(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<ThumbnailResult>> getThumbnail(const std::string& uri, const std::optional<ThumbnailOptions>& options) override {
      auto __result = _swiftPart.getThumbnail(uri, options);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MediaResult>> compressVideo(const std::string& uri, const CompressVideoOptions& options) override {
      auto __result = _swiftPart.compressVideo(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MediaResult>> flipVideo(const std::string& uri, const FlipOptions& options) override {
      auto __result = _swiftPart.flipVideo(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MediaResult>> rotateVideo(const std::string& uri, const RotateOptions& options) override {
      auto __result = _swiftPart.rotateVideo(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MediaResult>> processVideo(const std::string& uri, const ProcessVideoOptions& options) override {
      auto __result = _swiftPart.processVideo(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MediaResult>> processImage(const std::string& uri, const ProcessImageOptions& options) override {
      auto __result = _swiftPart.processImage(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MediaResult>> changeVideoSpeed(const std::string& uri, const SpeedOptions& options) override {
      auto __result = _swiftPart.changeVideoSpeed(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MediaResult>> extractAudio(const std::string& uri, const ExtractAudioOptions& options) override {
      auto __result = _swiftPart.extractAudio(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MediaResult>> generateVideoPreview(const std::string& uri, const GeneratePreviewOptions& options) override {
      auto __result = _swiftPart.generateVideoPreview(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<ConcatResult>> concatVideos(const std::vector<std::string>& clipPaths, const std::string& outputPath) override {
      auto __result = _swiftPart.concatVideos(clipPaths, outputPath);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MediaMetadata>> getMediaMetadata(const std::string& uri) override {
      auto __result = _swiftPart.getMediaMetadata(uri);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    MediaToolkit::HybridMediaToolkitSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::mediatoolkit
