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

#pragma once

#include "HybridMediaItemFactorySpec.hpp"

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

// Forward declaration of `HybridMediaItemSpec` to properly resolve imports.
namespace margelo::nitro::aviation { class HybridMediaItemSpec; }
// Forward declaration of `MediaItemConfig` to properly resolve imports.
namespace margelo::nitro::aviation { struct MediaItemConfig; }
// Forward declaration of `MediaType` to properly resolve imports.
namespace margelo::nitro::aviation { enum class MediaType; }
// Forward declaration of `DrmType` to properly resolve imports.
namespace margelo::nitro::aviation { enum class DrmType; }

#include <memory>
#include "HybridMediaItemSpec.hpp"
#include "MediaItemConfig.hpp"
#include <string>
#include "MediaType.hpp"
#include <optional>
#include <unordered_map>
#include "DrmType.hpp"

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

namespace margelo::nitro::aviation {

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

  public:
    // Get the Swift part
    inline Aviation::HybridMediaItemFactorySpec_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<HybridMediaItemFactorySpecSwift>(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<HybridMediaItemSpec> create(const MediaItemConfig& config) override {
      auto __result = _swiftPart.create(std::forward<decltype(config)>(config));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<HybridMediaItemSpec> fromUri(const std::string& uri) override {
      auto __result = _swiftPart.fromUri(uri);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    Aviation::HybridMediaItemFactorySpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::aviation
