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

#pragma once

#include "HybridOneMessageComposeSpec.hpp"

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

// Forward declaration of `MessageAttachment` to properly resolve imports.
namespace margelo::nitro::one { struct MessageAttachment; }
// Forward declaration of `ArrayBufferHolder` to properly resolve imports.
namespace NitroModules { class ArrayBufferHolder; }
// Forward declaration of `MessageComposeResult` to properly resolve imports.
namespace margelo::nitro::one { enum class MessageComposeResult; }

#include <string>
#include <vector>
#include <optional>
#include "MessageAttachment.hpp"
#include <NitroModules/ArrayBuffer.hpp>
#include <NitroModules/ArrayBufferHolder.hpp>
#include <NitroModules/Promise.hpp>
#include "MessageComposeResult.hpp"
#include <functional>

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

namespace margelo::nitro::one {

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

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

  public:
    // Properties
    inline std::optional<std::vector<std::string>> getRecipients() noexcept override {
      auto __result = _swiftPart.getRecipients();
      return __result;
    }
    inline void setRecipients(const std::optional<std::vector<std::string>>& recipients) noexcept override {
      _swiftPart.setRecipients(recipients);
    }
    inline std::optional<std::string> getBody() noexcept override {
      auto __result = _swiftPart.getBody();
      return __result;
    }
    inline void setBody(const std::optional<std::string>& body) noexcept override {
      _swiftPart.setBody(body);
    }
    inline std::optional<std::string> getSubject() noexcept override {
      auto __result = _swiftPart.getSubject();
      return __result;
    }
    inline void setSubject(const std::optional<std::string>& subject) noexcept override {
      _swiftPart.setSubject(subject);
    }
    inline std::vector<MessageAttachment> getAttachments() noexcept override {
      auto __result = _swiftPart.getAttachments();
      return __result;
    }

  public:
    // Methods
    inline bool canSendText() override {
      auto __result = _swiftPart.canSendText();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline bool canSendAttachments() override {
      auto __result = _swiftPart.canSendAttachments();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline bool canSendSubject() override {
      auto __result = _swiftPart.canSendSubject();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline bool isSupportedAttachmentUTI(const std::string& uti) override {
      auto __result = _swiftPart.isSupportedAttachmentUTI(uti);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline void disableUserAttachments() override {
      auto __result = _swiftPart.disableUserAttachments();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }
    inline bool addAttachmentData(const std::shared_ptr<ArrayBuffer>& attachment, const std::string& typeIdentifier, const std::string& filename) override {
      auto __result = _swiftPart.addAttachmentData(ArrayBufferHolder(attachment), typeIdentifier, filename);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline bool addAttachmentURL(const std::string& attachmentURL, const std::optional<std::string>& withAlternateFilename) override {
      auto __result = _swiftPart.addAttachmentURL(attachmentURL, withAlternateFilename);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<void>> present(bool animated, const std::function<void(MessageComposeResult /* result */)>& didFinish) override {
      auto __result = _swiftPart.present(std::forward<decltype(animated)>(animated), didFinish);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<void>> dismiss(bool animated) override {
      auto __result = _swiftPart.dismiss(std::forward<decltype(animated)>(animated));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    One::HybridOneMessageComposeSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::one
