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

#pragma once

#include "HybridThorViewSpec.hpp"

// Forward declaration of `HybridThorViewSpec_cxx` to properly resolve imports.
namespace NitroThor { class HybridThorViewSpec_cxx; }

// Forward declaration of `ThorShape` to properly resolve imports.
namespace margelo::nitro::thor { struct ThorShape; }
// Forward declaration of `ThorShapeType` to properly resolve imports.
namespace margelo::nitro::thor { enum class ThorShapeType; }
// Forward declaration of `ThorBackend` to properly resolve imports.
namespace margelo::nitro::thor { enum class ThorBackend; }

#include "ThorShape.hpp"
#include <vector>
#include "ThorShapeType.hpp"
#include <string>
#include <optional>
#include "ThorBackend.hpp"

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

namespace margelo::nitro::thor {

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

  public:
    // Get the Swift part
    inline NitroThor::HybridThorViewSpec_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<HybridThorViewSpecSwift>(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::vector<ThorShape> getShapes() noexcept override {
      auto __result = _swiftPart.getShapes();
      return __result;
    }
    inline void setShapes(const std::vector<ThorShape>& shapes) noexcept override {
      _swiftPart.setShapes(shapes);
    }
    inline std::optional<ThorBackend> getBackend() noexcept override {
      auto __result = _swiftPart.getBackend();
      return __result;
    }
    inline void setBackend(std::optional<ThorBackend> backend) noexcept override {
      _swiftPart.setBackend(backend);
    }

  public:
    // Methods
    inline void drawShapes(const std::vector<ThorShape>& shapes) override {
      auto __result = _swiftPart.drawShapes(shapes);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
    }

  private:
    NitroThor::HybridThorViewSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::thor
