///
/// NitroCropConfig.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © 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
#if __has_include(<NitroModules/JSIHelpers.hpp>)
#include <NitroModules/JSIHelpers.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
#include <NitroModules/PropNameIDCache.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif

// Forward declaration of `Language` to properly resolve imports.
namespace margelo::nitro::multipleimagepicker { enum class Language; }
// Forward declaration of `Presentation` to properly resolve imports.
namespace margelo::nitro::multipleimagepicker { enum class Presentation; }
// Forward declaration of `CropRatio` to properly resolve imports.
namespace margelo::nitro::multipleimagepicker { struct CropRatio; }

#include "Language.hpp"
#include "Presentation.hpp"
#include <optional>
#include "CropRatio.hpp"
#include <vector>

namespace margelo::nitro::multipleimagepicker {

  /**
   * A struct which can be represented as a JavaScript object (NitroCropConfig).
   */
  struct NitroCropConfig final {
  public:
    Language language     SWIFT_PRIVATE;
    Presentation presentation     SWIFT_PRIVATE;
    std::optional<bool> circle     SWIFT_PRIVATE;
    std::vector<CropRatio> ratio     SWIFT_PRIVATE;
    std::optional<CropRatio> defaultRatio     SWIFT_PRIVATE;
    std::optional<bool> freeStyle     SWIFT_PRIVATE;

  public:
    NitroCropConfig() = default;
    explicit NitroCropConfig(Language language, Presentation presentation, std::optional<bool> circle, std::vector<CropRatio> ratio, std::optional<CropRatio> defaultRatio, std::optional<bool> freeStyle): language(language), presentation(presentation), circle(circle), ratio(ratio), defaultRatio(defaultRatio), freeStyle(freeStyle) {}

  public:
    friend bool operator==(const NitroCropConfig& lhs, const NitroCropConfig& rhs) = default;
  };

} // namespace margelo::nitro::multipleimagepicker

namespace margelo::nitro {

  // C++ NitroCropConfig <> JS NitroCropConfig (object)
  template <>
  struct JSIConverter<margelo::nitro::multipleimagepicker::NitroCropConfig> final {
    static inline margelo::nitro::multipleimagepicker::NitroCropConfig fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::multipleimagepicker::NitroCropConfig(
        JSIConverter<margelo::nitro::multipleimagepicker::Language>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "language"))),
        JSIConverter<margelo::nitro::multipleimagepicker::Presentation>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "presentation"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "circle"))),
        JSIConverter<std::vector<margelo::nitro::multipleimagepicker::CropRatio>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ratio"))),
        JSIConverter<std::optional<margelo::nitro::multipleimagepicker::CropRatio>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "defaultRatio"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "freeStyle")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::multipleimagepicker::NitroCropConfig& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "language"), JSIConverter<margelo::nitro::multipleimagepicker::Language>::toJSI(runtime, arg.language));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "presentation"), JSIConverter<margelo::nitro::multipleimagepicker::Presentation>::toJSI(runtime, arg.presentation));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "circle"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.circle));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "ratio"), JSIConverter<std::vector<margelo::nitro::multipleimagepicker::CropRatio>>::toJSI(runtime, arg.ratio));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "defaultRatio"), JSIConverter<std::optional<margelo::nitro::multipleimagepicker::CropRatio>>::toJSI(runtime, arg.defaultRatio));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "freeStyle"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.freeStyle));
      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 (!nitro::isPlainObject(runtime, obj)) {
        return false;
      }
      if (!JSIConverter<margelo::nitro::multipleimagepicker::Language>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "language")))) return false;
      if (!JSIConverter<margelo::nitro::multipleimagepicker::Presentation>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "presentation")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "circle")))) return false;
      if (!JSIConverter<std::vector<margelo::nitro::multipleimagepicker::CropRatio>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ratio")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::multipleimagepicker::CropRatio>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "defaultRatio")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "freeStyle")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
