///
/// LDP_ConfigParams.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_CustomStyle` to properly resolve imports.
namespace margelo::nitro::lunardatepicker { struct LDP_CustomStyle; }
// Forward declaration of `LDP_CustomLanguage` to properly resolve imports.
namespace margelo::nitro::lunardatepicker { struct LDP_CustomLanguage; }

#include <unordered_map>
#include <string>
#include "LDP_CustomStyle.hpp"
#include "LDP_CustomLanguage.hpp"
#include <optional>

namespace margelo::nitro::lunardatepicker {

  /**
   * A struct which can be represented as a JavaScript object (LDP_ConfigParams).
   */
  struct LDP_ConfigParams {
  public:
    std::unordered_map<std::string, LDP_CustomStyle> themes     SWIFT_PRIVATE;
    std::unordered_map<std::string, LDP_CustomLanguage> languages     SWIFT_PRIVATE;
    double yearRangeOffset     SWIFT_PRIVATE;
    double timeZoneOffset     SWIFT_PRIVATE;
    std::optional<double> monthVisibleDebounceDelaySeconds     SWIFT_PRIVATE;

  public:
    LDP_ConfigParams() = default;
    explicit LDP_ConfigParams(std::unordered_map<std::string, LDP_CustomStyle> themes, std::unordered_map<std::string, LDP_CustomLanguage> languages, double yearRangeOffset, double timeZoneOffset, std::optional<double> monthVisibleDebounceDelaySeconds): themes(themes), languages(languages), yearRangeOffset(yearRangeOffset), timeZoneOffset(timeZoneOffset), monthVisibleDebounceDelaySeconds(monthVisibleDebounceDelaySeconds) {}
  };

} // namespace margelo::nitro::lunardatepicker

namespace margelo::nitro {

  using namespace margelo::nitro::lunardatepicker;

  // C++ LDP_ConfigParams <> JS LDP_ConfigParams (object)
  template <>
  struct JSIConverter<LDP_ConfigParams> final {
    static inline LDP_ConfigParams fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return LDP_ConfigParams(
        JSIConverter<std::unordered_map<std::string, LDP_CustomStyle>>::fromJSI(runtime, obj.getProperty(runtime, "themes")),
        JSIConverter<std::unordered_map<std::string, LDP_CustomLanguage>>::fromJSI(runtime, obj.getProperty(runtime, "languages")),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "yearRangeOffset")),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "timeZoneOffset")),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "monthVisibleDebounceDelaySeconds"))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const LDP_ConfigParams& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, "themes", JSIConverter<std::unordered_map<std::string, LDP_CustomStyle>>::toJSI(runtime, arg.themes));
      obj.setProperty(runtime, "languages", JSIConverter<std::unordered_map<std::string, LDP_CustomLanguage>>::toJSI(runtime, arg.languages));
      obj.setProperty(runtime, "yearRangeOffset", JSIConverter<double>::toJSI(runtime, arg.yearRangeOffset));
      obj.setProperty(runtime, "timeZoneOffset", JSIConverter<double>::toJSI(runtime, arg.timeZoneOffset));
      obj.setProperty(runtime, "monthVisibleDebounceDelaySeconds", JSIConverter<std::optional<double>>::toJSI(runtime, arg.monthVisibleDebounceDelaySeconds));
      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::unordered_map<std::string, LDP_CustomStyle>>::canConvert(runtime, obj.getProperty(runtime, "themes"))) return false;
      if (!JSIConverter<std::unordered_map<std::string, LDP_CustomLanguage>>::canConvert(runtime, obj.getProperty(runtime, "languages"))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "yearRangeOffset"))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "timeZoneOffset"))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "monthVisibleDebounceDelaySeconds"))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
