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

#pragma once

#if __has_include(<NitroModules/JSIConverter.hpp>)
#include <NitroModules/JSIConverter.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif
#if __has_include(<NitroModules/NitroDefines.hpp>)
#include <NitroModules/NitroDefines.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif

// Forward declaration of `LDP_PickerMode` to properly resolve imports.
namespace margelo::nitro::lunardatepicker { enum class LDP_PickerMode; }
// Forward declaration of `LDP_Range` to properly resolve imports.
namespace margelo::nitro::lunardatepicker { struct LDP_Range; }
// Forward declaration of `LDP_PriceData` to properly resolve imports.
namespace margelo::nitro::lunardatepicker { struct LDP_PriceData; }

#include <string>
#include "LDP_PickerMode.hpp"
#include <functional>
#include "LDP_Range.hpp"
#include <optional>
#include <vector>
#include "LDP_PriceData.hpp"

namespace margelo::nitro::lunardatepicker {

  /**
   * A struct which can be represented as a JavaScript object (LDP_PresentParams).
   */
  struct LDP_PresentParams {
  public:
    std::string theme     SWIFT_PRIVATE;
    std::string language     SWIFT_PRIVATE;
    std::string title     SWIFT_PRIVATE;
    std::string textCancel     SWIFT_PRIVATE;
    LDP_PickerMode mode     SWIFT_PRIVATE;
    std::function<void(const LDP_Range& /* result */)> onDone     SWIFT_PRIVATE;
    std::optional<std::string> minimumDate     SWIFT_PRIVATE;
    std::optional<std::string> maximumDate     SWIFT_PRIVATE;
    std::optional<LDP_Range> initialValue     SWIFT_PRIVATE;
    std::optional<std::vector<LDP_PriceData>> prices     SWIFT_PRIVATE;
    std::optional<std::function<void(const std::string& /* month */)>> onMonthVisible     SWIFT_PRIVATE;
    std::optional<std::function<void(const std::string& /* date */, const std::vector<std::string>& /* currentlyVisibleMonths */)>> onSelectFromDate     SWIFT_PRIVATE;

  public:
    LDP_PresentParams() = default;
    explicit LDP_PresentParams(std::string theme, std::string language, std::string title, std::string textCancel, LDP_PickerMode mode, std::function<void(const LDP_Range& /* result */)> onDone, std::optional<std::string> minimumDate, std::optional<std::string> maximumDate, std::optional<LDP_Range> initialValue, std::optional<std::vector<LDP_PriceData>> prices, std::optional<std::function<void(const std::string& /* month */)>> onMonthVisible, std::optional<std::function<void(const std::string& /* date */, const std::vector<std::string>& /* currentlyVisibleMonths */)>> onSelectFromDate): theme(theme), language(language), title(title), textCancel(textCancel), mode(mode), onDone(onDone), minimumDate(minimumDate), maximumDate(maximumDate), initialValue(initialValue), prices(prices), onMonthVisible(onMonthVisible), onSelectFromDate(onSelectFromDate) {}
  };

} // namespace margelo::nitro::lunardatepicker

namespace margelo::nitro {

  using namespace margelo::nitro::lunardatepicker;

  // C++ LDP_PresentParams <> JS LDP_PresentParams (object)
  template <>
  struct JSIConverter<LDP_PresentParams> final {
    static inline LDP_PresentParams fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return LDP_PresentParams(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "theme")),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "language")),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "title")),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "textCancel")),
        JSIConverter<LDP_PickerMode>::fromJSI(runtime, obj.getProperty(runtime, "mode")),
        JSIConverter<std::function<void(const LDP_Range& /* result */)>>::fromJSI(runtime, obj.getProperty(runtime, "onDone")),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "minimumDate")),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "maximumDate")),
        JSIConverter<std::optional<LDP_Range>>::fromJSI(runtime, obj.getProperty(runtime, "initialValue")),
        JSIConverter<std::optional<std::vector<LDP_PriceData>>>::fromJSI(runtime, obj.getProperty(runtime, "prices")),
        JSIConverter<std::optional<std::function<void(const std::string& /* month */)>>>::fromJSI(runtime, obj.getProperty(runtime, "onMonthVisible")),
        JSIConverter<std::optional<std::function<void(const std::string& /* date */, const std::vector<std::string>& /* currentlyVisibleMonths */)>>>::fromJSI(runtime, obj.getProperty(runtime, "onSelectFromDate"))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const LDP_PresentParams& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, "theme", JSIConverter<std::string>::toJSI(runtime, arg.theme));
      obj.setProperty(runtime, "language", JSIConverter<std::string>::toJSI(runtime, arg.language));
      obj.setProperty(runtime, "title", JSIConverter<std::string>::toJSI(runtime, arg.title));
      obj.setProperty(runtime, "textCancel", JSIConverter<std::string>::toJSI(runtime, arg.textCancel));
      obj.setProperty(runtime, "mode", JSIConverter<LDP_PickerMode>::toJSI(runtime, arg.mode));
      obj.setProperty(runtime, "onDone", JSIConverter<std::function<void(const LDP_Range& /* result */)>>::toJSI(runtime, arg.onDone));
      obj.setProperty(runtime, "minimumDate", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.minimumDate));
      obj.setProperty(runtime, "maximumDate", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.maximumDate));
      obj.setProperty(runtime, "initialValue", JSIConverter<std::optional<LDP_Range>>::toJSI(runtime, arg.initialValue));
      obj.setProperty(runtime, "prices", JSIConverter<std::optional<std::vector<LDP_PriceData>>>::toJSI(runtime, arg.prices));
      obj.setProperty(runtime, "onMonthVisible", JSIConverter<std::optional<std::function<void(const std::string& /* month */)>>>::toJSI(runtime, arg.onMonthVisible));
      obj.setProperty(runtime, "onSelectFromDate", JSIConverter<std::optional<std::function<void(const std::string& /* date */, const std::vector<std::string>& /* currentlyVisibleMonths */)>>>::toJSI(runtime, arg.onSelectFromDate));
      return obj;
    }
    static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
      if (!value.isObject()) {
        return false;
      }
      jsi::Object obj = value.getObject(runtime);
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "theme"))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "language"))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "title"))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "textCancel"))) return false;
      if (!JSIConverter<LDP_PickerMode>::canConvert(runtime, obj.getProperty(runtime, "mode"))) return false;
      if (!JSIConverter<std::function<void(const LDP_Range& /* result */)>>::canConvert(runtime, obj.getProperty(runtime, "onDone"))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "minimumDate"))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "maximumDate"))) return false;
      if (!JSIConverter<std::optional<LDP_Range>>::canConvert(runtime, obj.getProperty(runtime, "initialValue"))) return false;
      if (!JSIConverter<std::optional<std::vector<LDP_PriceData>>>::canConvert(runtime, obj.getProperty(runtime, "prices"))) return false;
      if (!JSIConverter<std::optional<std::function<void(const std::string& /* month */)>>>::canConvert(runtime, obj.getProperty(runtime, "onMonthVisible"))) return false;
      if (!JSIConverter<std::optional<std::function<void(const std::string& /* date */, const std::vector<std::string>& /* currentlyVisibleMonths */)>>>::canConvert(runtime, obj.getProperty(runtime, "onSelectFromDate"))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
