///
/// MediaInfoResult.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 `OperationType` to properly resolve imports.
namespace margelo::nitro::nitromediakit { enum class OperationType; }
// Forward declaration of `MediaType` to properly resolve imports.
namespace margelo::nitro::nitromediakit { enum class MediaType; }
// Forward declaration of `MediaInfoMedia` to properly resolve imports.
namespace margelo::nitro::nitromediakit { struct MediaInfoMedia; }
// Forward declaration of `MediaInfoWarning` to properly resolve imports.
namespace margelo::nitro::nitromediakit { struct MediaInfoWarning; }
// Forward declaration of `MediaInfoError` to properly resolve imports.
namespace margelo::nitro::nitromediakit { struct MediaInfoError; }

#include "OperationType.hpp"
#include "MediaType.hpp"
#include <string>
#include <optional>
#include "MediaInfoMedia.hpp"
#include "MediaInfoWarning.hpp"
#include <vector>
#include "MediaInfoError.hpp"

namespace margelo::nitro::nitromediakit {

  /**
   * A struct which can be represented as a JavaScript object (MediaInfoResult).
   */
  struct MediaInfoResult {
  public:
    bool ok     SWIFT_PRIVATE;
    OperationType operation     SWIFT_PRIVATE;
    MediaType type     SWIFT_PRIVATE;
    std::optional<std::string> inputUri     SWIFT_PRIVATE;
    std::optional<std::string> outputUri     SWIFT_PRIVATE;
    std::optional<MediaInfoMedia> media     SWIFT_PRIVATE;
    std::optional<std::vector<MediaInfoWarning>> warnings     SWIFT_PRIVATE;
    std::optional<MediaInfoError> error     SWIFT_PRIVATE;

  public:
    MediaInfoResult() = default;
    explicit MediaInfoResult(bool ok, OperationType operation, MediaType type, std::optional<std::string> inputUri, std::optional<std::string> outputUri, std::optional<MediaInfoMedia> media, std::optional<std::vector<MediaInfoWarning>> warnings, std::optional<MediaInfoError> error): ok(ok), operation(operation), type(type), inputUri(inputUri), outputUri(outputUri), media(media), warnings(warnings), error(error) {}
  };

} // namespace margelo::nitro::nitromediakit

namespace margelo::nitro {

  // C++ MediaInfoResult <> JS MediaInfoResult (object)
  template <>
  struct JSIConverter<margelo::nitro::nitromediakit::MediaInfoResult> final {
    static inline margelo::nitro::nitromediakit::MediaInfoResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::nitromediakit::MediaInfoResult(
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "ok")),
        JSIConverter<margelo::nitro::nitromediakit::OperationType>::fromJSI(runtime, obj.getProperty(runtime, "operation")),
        JSIConverter<margelo::nitro::nitromediakit::MediaType>::fromJSI(runtime, obj.getProperty(runtime, "type")),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "inputUri")),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "outputUri")),
        JSIConverter<std::optional<margelo::nitro::nitromediakit::MediaInfoMedia>>::fromJSI(runtime, obj.getProperty(runtime, "media")),
        JSIConverter<std::optional<std::vector<margelo::nitro::nitromediakit::MediaInfoWarning>>>::fromJSI(runtime, obj.getProperty(runtime, "warnings")),
        JSIConverter<std::optional<margelo::nitro::nitromediakit::MediaInfoError>>::fromJSI(runtime, obj.getProperty(runtime, "error"))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitromediakit::MediaInfoResult& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, "ok", JSIConverter<bool>::toJSI(runtime, arg.ok));
      obj.setProperty(runtime, "operation", JSIConverter<margelo::nitro::nitromediakit::OperationType>::toJSI(runtime, arg.operation));
      obj.setProperty(runtime, "type", JSIConverter<margelo::nitro::nitromediakit::MediaType>::toJSI(runtime, arg.type));
      obj.setProperty(runtime, "inputUri", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.inputUri));
      obj.setProperty(runtime, "outputUri", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.outputUri));
      obj.setProperty(runtime, "media", JSIConverter<std::optional<margelo::nitro::nitromediakit::MediaInfoMedia>>::toJSI(runtime, arg.media));
      obj.setProperty(runtime, "warnings", JSIConverter<std::optional<std::vector<margelo::nitro::nitromediakit::MediaInfoWarning>>>::toJSI(runtime, arg.warnings));
      obj.setProperty(runtime, "error", JSIConverter<std::optional<margelo::nitro::nitromediakit::MediaInfoError>>::toJSI(runtime, arg.error));
      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<bool>::canConvert(runtime, obj.getProperty(runtime, "ok"))) return false;
      if (!JSIConverter<margelo::nitro::nitromediakit::OperationType>::canConvert(runtime, obj.getProperty(runtime, "operation"))) return false;
      if (!JSIConverter<margelo::nitro::nitromediakit::MediaType>::canConvert(runtime, obj.getProperty(runtime, "type"))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "inputUri"))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "outputUri"))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::nitromediakit::MediaInfoMedia>>::canConvert(runtime, obj.getProperty(runtime, "media"))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::nitromediakit::MediaInfoWarning>>>::canConvert(runtime, obj.getProperty(runtime, "warnings"))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::nitromediakit::MediaInfoError>>::canConvert(runtime, obj.getProperty(runtime, "error"))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
