///
/// Accessibility.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 `AccessibilityCertification` to properly resolve imports.
namespace margelo::nitro::readium { struct AccessibilityCertification; }

#include <string>
#include <vector>
#include <optional>
#include "AccessibilityCertification.hpp"

namespace margelo::nitro::readium {

  /**
   * A struct which can be represented as a JavaScript object (Accessibility).
   */
  struct Accessibility final {
  public:
    std::optional<std::vector<std::string>> conformsTo     SWIFT_PRIVATE;
    std::optional<AccessibilityCertification> certification     SWIFT_PRIVATE;
    std::optional<std::vector<std::string>> accessMode     SWIFT_PRIVATE;
    std::optional<std::vector<std::string>> accessModeSufficient     SWIFT_PRIVATE;
    std::optional<std::vector<std::string>> feature     SWIFT_PRIVATE;
    std::optional<std::vector<std::string>> hazard     SWIFT_PRIVATE;
    std::optional<std::string> summary     SWIFT_PRIVATE;

  public:
    Accessibility() = default;
    explicit Accessibility(std::optional<std::vector<std::string>> conformsTo, std::optional<AccessibilityCertification> certification, std::optional<std::vector<std::string>> accessMode, std::optional<std::vector<std::string>> accessModeSufficient, std::optional<std::vector<std::string>> feature, std::optional<std::vector<std::string>> hazard, std::optional<std::string> summary): conformsTo(conformsTo), certification(certification), accessMode(accessMode), accessModeSufficient(accessModeSufficient), feature(feature), hazard(hazard), summary(summary) {}

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

} // namespace margelo::nitro::readium

namespace margelo::nitro {

  // C++ Accessibility <> JS Accessibility (object)
  template <>
  struct JSIConverter<margelo::nitro::readium::Accessibility> final {
    static inline margelo::nitro::readium::Accessibility fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::readium::Accessibility(
        JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "conformsTo"))),
        JSIConverter<std::optional<margelo::nitro::readium::AccessibilityCertification>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "certification"))),
        JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accessMode"))),
        JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accessModeSufficient"))),
        JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "feature"))),
        JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hazard"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "summary")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::readium::Accessibility& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "conformsTo"), JSIConverter<std::optional<std::vector<std::string>>>::toJSI(runtime, arg.conformsTo));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "certification"), JSIConverter<std::optional<margelo::nitro::readium::AccessibilityCertification>>::toJSI(runtime, arg.certification));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "accessMode"), JSIConverter<std::optional<std::vector<std::string>>>::toJSI(runtime, arg.accessMode));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "accessModeSufficient"), JSIConverter<std::optional<std::vector<std::string>>>::toJSI(runtime, arg.accessModeSufficient));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "feature"), JSIConverter<std::optional<std::vector<std::string>>>::toJSI(runtime, arg.feature));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "hazard"), JSIConverter<std::optional<std::vector<std::string>>>::toJSI(runtime, arg.hazard));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "summary"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.summary));
      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::optional<std::vector<std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "conformsTo")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::readium::AccessibilityCertification>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "certification")))) return false;
      if (!JSIConverter<std::optional<std::vector<std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accessMode")))) return false;
      if (!JSIConverter<std::optional<std::vector<std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accessModeSufficient")))) return false;
      if (!JSIConverter<std::optional<std::vector<std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "feature")))) return false;
      if (!JSIConverter<std::optional<std::vector<std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hazard")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "summary")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
