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

#pragma once

#include "HybridOneMapServicesSpec.hpp"

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

// Forward declaration of `MapPlace` to properly resolve imports.
namespace margelo::nitro::one { struct MapPlace; }
// Forward declaration of `MapCoordinate` to properly resolve imports.
namespace margelo::nitro::one { struct MapCoordinate; }
// Forward declaration of `MapSuggestion` to properly resolve imports.
namespace margelo::nitro::one { struct MapSuggestion; }
// Forward declaration of `MapRoute` to properly resolve imports.
namespace margelo::nitro::one { struct MapRoute; }
// Forward declaration of `MapRouteStep` to properly resolve imports.
namespace margelo::nitro::one { struct MapRouteStep; }
// Forward declaration of `MapTransport` to properly resolve imports.
namespace margelo::nitro::one { enum class MapTransport; }

#include "MapPlace.hpp"
#include <vector>
#include <NitroModules/Promise.hpp>
#include <string>
#include "MapCoordinate.hpp"
#include "MapSuggestion.hpp"
#include "MapRoute.hpp"
#include "MapRouteStep.hpp"
#include "MapTransport.hpp"

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

namespace margelo::nitro::one {

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

  public:
    // Get the Swift part
    inline One::HybridOneMapServicesSpec_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<HybridOneMapServicesSpecSwift>(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<std::vector<MapPlace>>> search(const std::string& query, const MapCoordinate& center, double radiusMeters) override {
      auto __result = _swiftPart.search(query, std::forward<decltype(center)>(center), std::forward<decltype(radiusMeters)>(radiusMeters));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<std::vector<MapSuggestion>>> autocomplete(const std::string& query, const MapCoordinate& center, double radiusMeters) override {
      auto __result = _swiftPart.autocomplete(query, std::forward<decltype(center)>(center), std::forward<decltype(radiusMeters)>(radiusMeters));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MapPlace>> resolveSuggestion(const std::string& id) override {
      auto __result = _swiftPart.resolveSuggestion(id);
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MapRoute>> directions(const MapCoordinate& origin, const MapCoordinate& destination, MapTransport transport) override {
      auto __result = _swiftPart.directions(std::forward<decltype(origin)>(origin), std::forward<decltype(destination)>(destination), static_cast<int>(transport));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    One::HybridOneMapServicesSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::one
