///
/// LDP_PriceUpdateParams.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_PriceData` to properly resolve imports.
namespace margelo::nitro::lunardatepicker { struct LDP_PriceData; }

#include <string>
#include <vector>
#include "LDP_PriceData.hpp"

namespace margelo::nitro::lunardatepicker {

  /**
   * A struct which can be represented as a JavaScript object (LDP_PriceUpdateParams).
   */
  struct LDP_PriceUpdateParams {
  public:
    std::string month     SWIFT_PRIVATE;
    std::vector<LDP_PriceData> prices     SWIFT_PRIVATE;

  public:
    LDP_PriceUpdateParams() = default;
    explicit LDP_PriceUpdateParams(std::string month, std::vector<LDP_PriceData> prices): month(month), prices(prices) {}
  };

} // namespace margelo::nitro::lunardatepicker

namespace margelo::nitro {

  using namespace margelo::nitro::lunardatepicker;

  // C++ LDP_PriceUpdateParams <> JS LDP_PriceUpdateParams (object)
  template <>
  struct JSIConverter<LDP_PriceUpdateParams> final {
    static inline LDP_PriceUpdateParams fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return LDP_PriceUpdateParams(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "month")),
        JSIConverter<std::vector<LDP_PriceData>>::fromJSI(runtime, obj.getProperty(runtime, "prices"))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const LDP_PriceUpdateParams& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, "month", JSIConverter<std::string>::toJSI(runtime, arg.month));
      obj.setProperty(runtime, "prices", JSIConverter<std::vector<LDP_PriceData>>::toJSI(runtime, arg.prices));
      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, "month"))) return false;
      if (!JSIConverter<std::vector<LDP_PriceData>>::canConvert(runtime, obj.getProperty(runtime, "prices"))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
