///
/// NativeTranscriptResult.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 `NativeTranscriptSegment` to properly resolve imports.
namespace margelo::nitro::clarion::azure { struct NativeTranscriptSegment; }

#include <string>
#include "NativeTranscriptSegment.hpp"
#include <vector>

namespace margelo::nitro::clarion::azure {

  /**
   * A struct which can be represented as a JavaScript object (NativeTranscriptResult).
   */
  struct NativeTranscriptResult final {
  public:
    std::string id     SWIFT_PRIVATE;
    std::string sessionId     SWIFT_PRIVATE;
    double timestamp     SWIFT_PRIVATE;
    std::string text     SWIFT_PRIVATE;
    bool isFinal     SWIFT_PRIVATE;
    std::string language     SWIFT_PRIVATE;
    double confidence     SWIFT_PRIVATE;
    double offsetMs     SWIFT_PRIVATE;
    double durationMs     SWIFT_PRIVATE;
    std::string speakerId     SWIFT_PRIVATE;
    std::vector<NativeTranscriptSegment> segments     SWIFT_PRIVATE;

  public:
    NativeTranscriptResult() = default;
    explicit NativeTranscriptResult(std::string id, std::string sessionId, double timestamp, std::string text, bool isFinal, std::string language, double confidence, double offsetMs, double durationMs, std::string speakerId, std::vector<NativeTranscriptSegment> segments): id(id), sessionId(sessionId), timestamp(timestamp), text(text), isFinal(isFinal), language(language), confidence(confidence), offsetMs(offsetMs), durationMs(durationMs), speakerId(speakerId), segments(segments) {}

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

} // namespace margelo::nitro::clarion::azure

namespace margelo::nitro {

  // C++ NativeTranscriptResult <> JS NativeTranscriptResult (object)
  template <>
  struct JSIConverter<margelo::nitro::clarion::azure::NativeTranscriptResult> final {
    static inline margelo::nitro::clarion::azure::NativeTranscriptResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::clarion::azure::NativeTranscriptResult(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sessionId"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isFinal"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "language"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "confidence"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "offsetMs"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "durationMs"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "speakerId"))),
        JSIConverter<std::vector<margelo::nitro::clarion::azure::NativeTranscriptSegment>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "segments")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::clarion::azure::NativeTranscriptResult& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "id"), JSIConverter<std::string>::toJSI(runtime, arg.id));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "sessionId"), JSIConverter<std::string>::toJSI(runtime, arg.sessionId));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestamp"), JSIConverter<double>::toJSI(runtime, arg.timestamp));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "text"), JSIConverter<std::string>::toJSI(runtime, arg.text));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "isFinal"), JSIConverter<bool>::toJSI(runtime, arg.isFinal));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "language"), JSIConverter<std::string>::toJSI(runtime, arg.language));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "confidence"), JSIConverter<double>::toJSI(runtime, arg.confidence));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "offsetMs"), JSIConverter<double>::toJSI(runtime, arg.offsetMs));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "durationMs"), JSIConverter<double>::toJSI(runtime, arg.durationMs));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "speakerId"), JSIConverter<std::string>::toJSI(runtime, arg.speakerId));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "segments"), JSIConverter<std::vector<margelo::nitro::clarion::azure::NativeTranscriptSegment>>::toJSI(runtime, arg.segments));
      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, "id")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sessionId")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestamp")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isFinal")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "language")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "confidence")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "offsetMs")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "durationMs")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "speakerId")))) return false;
      if (!JSIConverter<std::vector<margelo::nitro::clarion::azure::NativeTranscriptSegment>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "segments")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
