///
/// PickerResult.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 `ResultType` to properly resolve imports.
namespace margelo::nitro::multipleimagepicker { enum class ResultType; }

#include <string>
#include <optional>
#include "ResultType.hpp"

namespace margelo::nitro::multipleimagepicker {

  /**
   * A struct which can be represented as a JavaScript object (PickerResult).
   */
  struct PickerResult {
  public:
    std::string localIdentifier     SWIFT_PRIVATE;
    double width     SWIFT_PRIVATE;
    double height     SWIFT_PRIVATE;
    std::string mime     SWIFT_PRIVATE;
    double size     SWIFT_PRIVATE;
    std::optional<double> bucketId     SWIFT_PRIVATE;
    std::optional<std::string> realPath     SWIFT_PRIVATE;
    std::optional<std::string> parentFolderName     SWIFT_PRIVATE;
    std::optional<double> creationDate     SWIFT_PRIVATE;
    std::optional<bool> crop     SWIFT_PRIVATE;
    std::string path     SWIFT_PRIVATE;
    ResultType type     SWIFT_PRIVATE;
    std::optional<double> duration     SWIFT_PRIVATE;
    std::optional<std::string> thumbnail     SWIFT_PRIVATE;
    std::optional<std::string> fileName     SWIFT_PRIVATE;

  public:
    PickerResult() = default;
    explicit PickerResult(std::string localIdentifier, double width, double height, std::string mime, double size, std::optional<double> bucketId, std::optional<std::string> realPath, std::optional<std::string> parentFolderName, std::optional<double> creationDate, std::optional<bool> crop, std::string path, ResultType type, std::optional<double> duration, std::optional<std::string> thumbnail, std::optional<std::string> fileName): localIdentifier(localIdentifier), width(width), height(height), mime(mime), size(size), bucketId(bucketId), realPath(realPath), parentFolderName(parentFolderName), creationDate(creationDate), crop(crop), path(path), type(type), duration(duration), thumbnail(thumbnail), fileName(fileName) {}
  };

} // namespace margelo::nitro::multipleimagepicker

namespace margelo::nitro {

  using namespace margelo::nitro::multipleimagepicker;

  // C++ PickerResult <> JS PickerResult (object)
  template <>
  struct JSIConverter<PickerResult> final {
    static inline PickerResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return PickerResult(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "localIdentifier")),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "width")),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "height")),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "mime")),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "size")),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "bucketId")),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "realPath")),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "parentFolderName")),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "creationDate")),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "crop")),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "path")),
        JSIConverter<ResultType>::fromJSI(runtime, obj.getProperty(runtime, "type")),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "duration")),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "thumbnail")),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "fileName"))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const PickerResult& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, "localIdentifier", JSIConverter<std::string>::toJSI(runtime, arg.localIdentifier));
      obj.setProperty(runtime, "width", JSIConverter<double>::toJSI(runtime, arg.width));
      obj.setProperty(runtime, "height", JSIConverter<double>::toJSI(runtime, arg.height));
      obj.setProperty(runtime, "mime", JSIConverter<std::string>::toJSI(runtime, arg.mime));
      obj.setProperty(runtime, "size", JSIConverter<double>::toJSI(runtime, arg.size));
      obj.setProperty(runtime, "bucketId", JSIConverter<std::optional<double>>::toJSI(runtime, arg.bucketId));
      obj.setProperty(runtime, "realPath", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.realPath));
      obj.setProperty(runtime, "parentFolderName", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.parentFolderName));
      obj.setProperty(runtime, "creationDate", JSIConverter<std::optional<double>>::toJSI(runtime, arg.creationDate));
      obj.setProperty(runtime, "crop", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.crop));
      obj.setProperty(runtime, "path", JSIConverter<std::string>::toJSI(runtime, arg.path));
      obj.setProperty(runtime, "type", JSIConverter<ResultType>::toJSI(runtime, arg.type));
      obj.setProperty(runtime, "duration", JSIConverter<std::optional<double>>::toJSI(runtime, arg.duration));
      obj.setProperty(runtime, "thumbnail", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.thumbnail));
      obj.setProperty(runtime, "fileName", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.fileName));
      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, "localIdentifier"))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "width"))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "height"))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "mime"))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "size"))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "bucketId"))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "realPath"))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "parentFolderName"))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "creationDate"))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "crop"))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "path"))) return false;
      if (!JSIConverter<ResultType>::canConvert(runtime, obj.getProperty(runtime, "type"))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "duration"))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "thumbnail"))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "fileName"))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
