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

#pragma once

#include "HybridOneImageManipulatorSpec.hpp"

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

// Forward declaration of `ImageTransformResult` to properly resolve imports.
namespace margelo::nitro::one { struct ImageTransformResult; }
// Forward declaration of `ImageTransformOptions` to properly resolve imports.
namespace margelo::nitro::one { struct ImageTransformOptions; }
// Forward declaration of `ImageCrop` to properly resolve imports.
namespace margelo::nitro::one { struct ImageCrop; }
// Forward declaration of `ImageResize` to properly resolve imports.
namespace margelo::nitro::one { struct ImageResize; }
// Forward declaration of `OneImageFlip` to properly resolve imports.
namespace margelo::nitro::one { enum class OneImageFlip; }
// Forward declaration of `OneImageFormat` to properly resolve imports.
namespace margelo::nitro::one { enum class OneImageFormat; }

#include "ImageTransformResult.hpp"
#include <NitroModules/Promise.hpp>
#include <string>
#include "ImageTransformOptions.hpp"
#include "ImageCrop.hpp"
#include <optional>
#include "ImageResize.hpp"
#include "OneImageFlip.hpp"
#include "OneImageFormat.hpp"

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

namespace margelo::nitro::one {

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

  public:
    // Get the Swift part
    inline One::HybridOneImageManipulatorSpec_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<HybridOneImageManipulatorSpecSwift>(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<ImageTransformResult>> transform(const std::string& uri, const ImageTransformOptions& options) override {
      auto __result = _swiftPart.transform(uri, std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    One::HybridOneImageManipulatorSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::one
