///
/// TargetDynamicRange.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 `TargetDynamicRangeBitDepth` to properly resolve imports.
namespace margelo::nitro::camera { enum class TargetDynamicRangeBitDepth; }
// Forward declaration of `TargetColorSpace` to properly resolve imports.
namespace margelo::nitro::camera { enum class TargetColorSpace; }
// Forward declaration of `TargetColorRange` to properly resolve imports.
namespace margelo::nitro::camera { enum class TargetColorRange; }

#include "TargetDynamicRangeBitDepth.hpp"
#include "TargetColorSpace.hpp"
#include "TargetColorRange.hpp"

namespace margelo::nitro::camera {

  /**
   * A struct which can be represented as a JavaScript object (TargetDynamicRange).
   */
  struct TargetDynamicRange final {
  public:
    TargetDynamicRangeBitDepth bitDepth     SWIFT_PRIVATE;
    TargetColorSpace colorSpace     SWIFT_PRIVATE;
    TargetColorRange colorRange     SWIFT_PRIVATE;

  public:
    TargetDynamicRange() = default;
    explicit TargetDynamicRange(TargetDynamicRangeBitDepth bitDepth, TargetColorSpace colorSpace, TargetColorRange colorRange): bitDepth(bitDepth), colorSpace(colorSpace), colorRange(colorRange) {}

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

} // namespace margelo::nitro::camera

namespace margelo::nitro {

  // C++ TargetDynamicRange <> JS TargetDynamicRange (object)
  template <>
  struct JSIConverter<margelo::nitro::camera::TargetDynamicRange> final {
    static inline margelo::nitro::camera::TargetDynamicRange fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::camera::TargetDynamicRange(
        JSIConverter<margelo::nitro::camera::TargetDynamicRangeBitDepth>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bitDepth"))),
        JSIConverter<margelo::nitro::camera::TargetColorSpace>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "colorSpace"))),
        JSIConverter<margelo::nitro::camera::TargetColorRange>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "colorRange")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::camera::TargetDynamicRange& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "bitDepth"), JSIConverter<margelo::nitro::camera::TargetDynamicRangeBitDepth>::toJSI(runtime, arg.bitDepth));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "colorSpace"), JSIConverter<margelo::nitro::camera::TargetColorSpace>::toJSI(runtime, arg.colorSpace));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "colorRange"), JSIConverter<margelo::nitro::camera::TargetColorRange>::toJSI(runtime, arg.colorRange));
      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<margelo::nitro::camera::TargetDynamicRangeBitDepth>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bitDepth")))) return false;
      if (!JSIConverter<margelo::nitro::camera::TargetColorSpace>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "colorSpace")))) return false;
      if (!JSIConverter<margelo::nitro::camera::TargetColorRange>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "colorRange")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
