///
/// VideoInfo.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 `WGS84Coordinate` to properly resolve imports.
namespace margelo::nitro::videopipeline { struct WGS84Coordinate; }

#include <string>
#include <chrono>
#include <optional>
#include "WGS84Coordinate.hpp"
#include <unordered_map>

namespace margelo::nitro::videopipeline {

  /**
   * A struct which can be represented as a JavaScript object (VideoInfo).
   */
  struct VideoInfo final {
  public:
    std::string uri     SWIFT_PRIVATE;
    double durationSec     SWIFT_PRIVATE;
    double width     SWIFT_PRIVATE;
    double height     SWIFT_PRIVATE;
    double codedWidth     SWIFT_PRIVATE;
    double codedHeight     SWIFT_PRIVATE;
    double fps     SWIFT_PRIVATE;
    double bitRate     SWIFT_PRIVATE;
    double fileSizeBytes     SWIFT_PRIVATE;
    std::string codec     SWIFT_PRIVATE;
    std::string container     SWIFT_PRIVATE;
    bool hasAudio     SWIFT_PRIVATE;
    bool isHDR     SWIFT_PRIVATE;
    double rotation     SWIFT_PRIVATE;
    std::optional<std::chrono::system_clock::time_point> creationDate     SWIFT_PRIVATE;
    std::optional<WGS84Coordinate> location     SWIFT_PRIVATE;
    std::optional<std::string> description     SWIFT_PRIVATE;
    std::optional<std::unordered_map<std::string, std::string>> custom     SWIFT_PRIVATE;

  public:
    VideoInfo() = default;
    explicit VideoInfo(std::string uri, double durationSec, double width, double height, double codedWidth, double codedHeight, double fps, double bitRate, double fileSizeBytes, std::string codec, std::string container, bool hasAudio, bool isHDR, double rotation, std::optional<std::chrono::system_clock::time_point> creationDate, std::optional<WGS84Coordinate> location, std::optional<std::string> description, std::optional<std::unordered_map<std::string, std::string>> custom): uri(uri), durationSec(durationSec), width(width), height(height), codedWidth(codedWidth), codedHeight(codedHeight), fps(fps), bitRate(bitRate), fileSizeBytes(fileSizeBytes), codec(codec), container(container), hasAudio(hasAudio), isHDR(isHDR), rotation(rotation), creationDate(creationDate), location(location), description(description), custom(custom) {}

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

} // namespace margelo::nitro::videopipeline

namespace margelo::nitro {

  // C++ VideoInfo <> JS VideoInfo (object)
  template <>
  struct JSIConverter<margelo::nitro::videopipeline::VideoInfo> final {
    static inline margelo::nitro::videopipeline::VideoInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::videopipeline::VideoInfo(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uri"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "durationSec"))),
        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, "codedWidth"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "codedHeight"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fps"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bitRate"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fileSizeBytes"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "codec"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "container"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasAudio"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isHDR"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rotation"))),
        JSIConverter<std::optional<std::chrono::system_clock::time_point>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "creationDate"))),
        JSIConverter<std::optional<margelo::nitro::videopipeline::WGS84Coordinate>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "location"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "description"))),
        JSIConverter<std::optional<std::unordered_map<std::string, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "custom")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::videopipeline::VideoInfo& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "uri"), JSIConverter<std::string>::toJSI(runtime, arg.uri));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "durationSec"), JSIConverter<double>::toJSI(runtime, arg.durationSec));
      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, "codedWidth"), JSIConverter<double>::toJSI(runtime, arg.codedWidth));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "codedHeight"), JSIConverter<double>::toJSI(runtime, arg.codedHeight));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "fps"), JSIConverter<double>::toJSI(runtime, arg.fps));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "bitRate"), JSIConverter<double>::toJSI(runtime, arg.bitRate));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "fileSizeBytes"), JSIConverter<double>::toJSI(runtime, arg.fileSizeBytes));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "codec"), JSIConverter<std::string>::toJSI(runtime, arg.codec));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "container"), JSIConverter<std::string>::toJSI(runtime, arg.container));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "hasAudio"), JSIConverter<bool>::toJSI(runtime, arg.hasAudio));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "isHDR"), JSIConverter<bool>::toJSI(runtime, arg.isHDR));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "rotation"), JSIConverter<double>::toJSI(runtime, arg.rotation));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "creationDate"), JSIConverter<std::optional<std::chrono::system_clock::time_point>>::toJSI(runtime, arg.creationDate));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "location"), JSIConverter<std::optional<margelo::nitro::videopipeline::WGS84Coordinate>>::toJSI(runtime, arg.location));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "description"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.description));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "custom"), JSIConverter<std::optional<std::unordered_map<std::string, std::string>>>::toJSI(runtime, arg.custom));
      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, "uri")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "durationSec")))) 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, "codedWidth")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "codedHeight")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fps")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bitRate")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fileSizeBytes")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "codec")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "container")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasAudio")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isHDR")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rotation")))) return false;
      if (!JSIConverter<std::optional<std::chrono::system_clock::time_point>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "creationDate")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::videopipeline::WGS84Coordinate>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "location")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "description")))) return false;
      if (!JSIConverter<std::optional<std::unordered_map<std::string, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "custom")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
