///
/// NitroCropConfig.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 `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 <vector>
#include "CropRatio.hpp"

namespace margelo::nitro::multipleimagepicker {

  /**
   * A struct which can be represented as a JavaScript object (NitroCropConfig).
   */
  struct NitroCropConfig {
  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) {}
  };

} // namespace margelo::nitro::multipleimagepicker

namespace margelo::nitro {

  using namespace margelo::nitro::multipleimagepicker;

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

} // namespace margelo::nitro
