///
/// MediaMetadata.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 `LocationData` to properly resolve imports.
namespace margelo::nitro::mediatoolkit { struct LocationData; }

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

namespace margelo::nitro::mediatoolkit {

  /**
   * A struct which can be represented as a JavaScript object (MediaMetadata).
   */
  struct MediaMetadata final {
  public:
    std::string type     SWIFT_PRIVATE;
    double width     SWIFT_PRIVATE;
    double height     SWIFT_PRIVATE;
    double size     SWIFT_PRIVATE;
    double duration     SWIFT_PRIVATE;
    std::string mime     SWIFT_PRIVATE;
    std::optional<std::string> make     SWIFT_PRIVATE;
    std::optional<std::string> model     SWIFT_PRIVATE;
    std::optional<std::string> datetime     SWIFT_PRIVATE;
    std::optional<LocationData> location     SWIFT_PRIVATE;
    std::optional<double> aperture     SWIFT_PRIVATE;
    std::optional<double> exposureTime     SWIFT_PRIVATE;
    std::optional<double> iso     SWIFT_PRIVATE;
    std::optional<double> focalLength     SWIFT_PRIVATE;

  public:
    MediaMetadata() = default;
    explicit MediaMetadata(std::string type, double width, double height, double size, double duration, std::string mime, std::optional<std::string> make, std::optional<std::string> model, std::optional<std::string> datetime, std::optional<LocationData> location, std::optional<double> aperture, std::optional<double> exposureTime, std::optional<double> iso, std::optional<double> focalLength): type(type), width(width), height(height), size(size), duration(duration), mime(mime), make(make), model(model), datetime(datetime), location(location), aperture(aperture), exposureTime(exposureTime), iso(iso), focalLength(focalLength) {}

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

} // namespace margelo::nitro::mediatoolkit

namespace margelo::nitro {

  // C++ MediaMetadata <> JS MediaMetadata (object)
  template <>
  struct JSIConverter<margelo::nitro::mediatoolkit::MediaMetadata> final {
    static inline margelo::nitro::mediatoolkit::MediaMetadata fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::mediatoolkit::MediaMetadata(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "size"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mime"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "make"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "model"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "datetime"))),
        JSIConverter<std::optional<margelo::nitro::mediatoolkit::LocationData>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "location"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "aperture"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "exposureTime"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "iso"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "focalLength")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::mediatoolkit::MediaMetadata& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<std::string>::toJSI(runtime, arg.type));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "width"), JSIConverter<double>::toJSI(runtime, arg.width));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "height"), JSIConverter<double>::toJSI(runtime, arg.height));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "size"), JSIConverter<double>::toJSI(runtime, arg.size));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "duration"), JSIConverter<double>::toJSI(runtime, arg.duration));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "mime"), JSIConverter<std::string>::toJSI(runtime, arg.mime));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "make"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.make));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "model"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.model));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "datetime"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.datetime));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "location"), JSIConverter<std::optional<margelo::nitro::mediatoolkit::LocationData>>::toJSI(runtime, arg.location));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "aperture"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.aperture));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "exposureTime"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.exposureTime));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "iso"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.iso));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "focalLength"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.focalLength));
      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<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "size")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "mime")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "make")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "model")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "datetime")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::mediatoolkit::LocationData>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "location")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "aperture")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "exposureTime")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "iso")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "focalLength")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
