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

#pragma once

#include "HybridMedicationModuleSpec.hpp"

// Forward declaration of `HybridMedicationModuleSpec_cxx` to properly resolve imports.
namespace ReactNativeHealthkit { class HybridMedicationModuleSpec_cxx; }

// Forward declaration of `UserAnnotatedMedication` to properly resolve imports.
namespace margelo::nitro::healthkit { struct UserAnnotatedMedication; }
// Forward declaration of `MedicationConcept` to properly resolve imports.
namespace margelo::nitro::healthkit { struct MedicationConcept; }
// Forward declaration of `GeneralForm` to properly resolve imports.
namespace margelo::nitro::healthkit { enum class GeneralForm; }
// Forward declaration of `RelatedCoding` to properly resolve imports.
namespace margelo::nitro::healthkit { struct RelatedCoding; }
// Forward declaration of `MedicationDoseEvent` to properly resolve imports.
namespace margelo::nitro::healthkit { struct MedicationDoseEvent; }
// Forward declaration of `MedicationDoseEventScheduleType` to properly resolve imports.
namespace margelo::nitro::healthkit { enum class MedicationDoseEventScheduleType; }
// Forward declaration of `MedicationDoseEventLogStatus` to properly resolve imports.
namespace margelo::nitro::healthkit { enum class MedicationDoseEventLogStatus; }
// Forward declaration of `SampleType` to properly resolve imports.
namespace margelo::nitro::healthkit { struct SampleType; }
// Forward declaration of `SourceRevision` to properly resolve imports.
namespace margelo::nitro::healthkit { struct SourceRevision; }
// Forward declaration of `HybridSourceProxySpec` to properly resolve imports.
namespace margelo::nitro::healthkit { class HybridSourceProxySpec; }
// Forward declaration of `Device` to properly resolve imports.
namespace margelo::nitro::healthkit { struct Device; }
// Forward declaration of `QueryOptionsWithSortOrder` to properly resolve imports.
namespace margelo::nitro::healthkit { struct QueryOptionsWithSortOrder; }
// Forward declaration of `FilterForSamples` to properly resolve imports.
namespace margelo::nitro::healthkit { struct FilterForSamples; }
// Forward declaration of `FilterForSamplesBase` to properly resolve imports.
namespace margelo::nitro::healthkit { struct FilterForSamplesBase; }
// Forward declaration of `PredicateWithMetadataKey` to properly resolve imports.
namespace margelo::nitro::healthkit { struct PredicateWithMetadataKey; }
// Forward declaration of `ComparisonPredicateOperator` to properly resolve imports.
namespace margelo::nitro::healthkit { enum class ComparisonPredicateOperator; }
// Forward declaration of `DateFilter` to properly resolve imports.
namespace margelo::nitro::healthkit { struct DateFilter; }
// Forward declaration of `HybridWorkoutProxySpec` to properly resolve imports.
namespace margelo::nitro::healthkit { class HybridWorkoutProxySpec; }
// Forward declaration of `MedicationDoseEventsWithAnchorResponse` to properly resolve imports.
namespace margelo::nitro::healthkit { struct MedicationDoseEventsWithAnchorResponse; }
// Forward declaration of `DeletedSample` to properly resolve imports.
namespace margelo::nitro::healthkit { struct DeletedSample; }
// Forward declaration of `QueryOptionsWithAnchor` to properly resolve imports.
namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchor; }

#include "UserAnnotatedMedication.hpp"
#include <vector>
#include <NitroModules/Promise.hpp>
#include <string>
#include <optional>
#include "MedicationConcept.hpp"
#include "GeneralForm.hpp"
#include "RelatedCoding.hpp"
#include "MedicationDoseEvent.hpp"
#include "MedicationDoseEventScheduleType.hpp"
#include <chrono>
#include "MedicationDoseEventLogStatus.hpp"
#include "SampleType.hpp"
#include <NitroModules/AnyMap.hpp>
#include "SourceRevision.hpp"
#include <memory>
#include "HybridSourceProxySpec.hpp"
#include "Device.hpp"
#include "QueryOptionsWithSortOrder.hpp"
#include "FilterForSamples.hpp"
#include "FilterForSamplesBase.hpp"
#include "PredicateWithMetadataKey.hpp"
#include "ComparisonPredicateOperator.hpp"
#include <variant>
#include "DateFilter.hpp"
#include "HybridWorkoutProxySpec.hpp"
#include "MedicationDoseEventsWithAnchorResponse.hpp"
#include "DeletedSample.hpp"
#include "QueryOptionsWithAnchor.hpp"

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

namespace margelo::nitro::healthkit {

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

  public:
    // Get the Swift part
    inline ReactNativeHealthkit::HybridMedicationModuleSpec_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<HybridMedicationModuleSpecSwift>(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<UserAnnotatedMedication>>> queryMedications() override {
      auto __result = _swiftPart.queryMedications();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<bool>> requestMedicationsAuthorization() override {
      auto __result = _swiftPart.requestMedicationsAuthorization();
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<std::vector<MedicationDoseEvent>>> queryMedicationEvents(const QueryOptionsWithSortOrder& options) override {
      auto __result = _swiftPart.queryMedicationEvents(std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }
    inline std::shared_ptr<Promise<MedicationDoseEventsWithAnchorResponse>> queryMedicationEventsWithAnchor(const QueryOptionsWithAnchor& options) override {
      auto __result = _swiftPart.queryMedicationEventsWithAnchor(std::forward<decltype(options)>(options));
      if (__result.hasError()) [[unlikely]] {
        std::rethrow_exception(__result.error());
      }
      auto __value = std::move(__result.value());
      return __value;
    }

  private:
    ReactNativeHealthkit::HybridMedicationModuleSpec_cxx _swiftPart;
  };

} // namespace margelo::nitro::healthkit
