///
/// PublicationMetadata.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 `Accessibility` to properly resolve imports.
namespace margelo::nitro::readium { struct Accessibility; }
// Forward declaration of `Contributor` to properly resolve imports.
namespace margelo::nitro::readium { struct Contributor; }
// Forward declaration of `Subject` to properly resolve imports.
namespace margelo::nitro::readium { struct Subject; }
// Forward declaration of `BelongsTo` to properly resolve imports.
namespace margelo::nitro::readium { struct BelongsTo; }

#include <string>
#include <optional>
#include "Accessibility.hpp"
#include <vector>
#include "Contributor.hpp"
#include "Subject.hpp"
#include "BelongsTo.hpp"

namespace margelo::nitro::readium {

  /**
   * A struct which can be represented as a JavaScript object (PublicationMetadata).
   */
  struct PublicationMetadata final {
  public:
    std::string title     SWIFT_PRIVATE;
    std::optional<std::string> sortAs     SWIFT_PRIVATE;
    std::optional<std::string> subtitle     SWIFT_PRIVATE;
    std::optional<std::string> identifier     SWIFT_PRIVATE;
    std::optional<Accessibility> accessibility     SWIFT_PRIVATE;
    std::optional<std::string> modified     SWIFT_PRIVATE;
    std::optional<std::string> published     SWIFT_PRIVATE;
    std::optional<std::vector<std::string>> language     SWIFT_PRIVATE;
    std::optional<std::vector<Contributor>> author     SWIFT_PRIVATE;
    std::optional<std::vector<Contributor>> translator     SWIFT_PRIVATE;
    std::optional<std::vector<Contributor>> editor     SWIFT_PRIVATE;
    std::optional<std::vector<Contributor>> artist     SWIFT_PRIVATE;
    std::optional<std::vector<Contributor>> illustrator     SWIFT_PRIVATE;
    std::optional<std::vector<Contributor>> letterer     SWIFT_PRIVATE;
    std::optional<std::vector<Contributor>> penciler     SWIFT_PRIVATE;
    std::optional<std::vector<Contributor>> colorist     SWIFT_PRIVATE;
    std::optional<std::vector<Contributor>> inker     SWIFT_PRIVATE;
    std::optional<std::vector<Contributor>> narrator     SWIFT_PRIVATE;
    std::optional<std::vector<Contributor>> contributor     SWIFT_PRIVATE;
    std::optional<std::vector<Contributor>> publisher     SWIFT_PRIVATE;
    std::optional<std::vector<Contributor>> imprint     SWIFT_PRIVATE;
    std::optional<std::vector<Subject>> subject     SWIFT_PRIVATE;
    std::optional<std::string> layout     SWIFT_PRIVATE;
    std::optional<std::string> readingProgression     SWIFT_PRIVATE;
    std::optional<std::string> description     SWIFT_PRIVATE;
    std::optional<double> duration     SWIFT_PRIVATE;
    std::optional<double> numberOfPages     SWIFT_PRIVATE;
    std::optional<BelongsTo> belongsTo     SWIFT_PRIVATE;

  public:
    PublicationMetadata() = default;
    explicit PublicationMetadata(std::string title, std::optional<std::string> sortAs, std::optional<std::string> subtitle, std::optional<std::string> identifier, std::optional<Accessibility> accessibility, std::optional<std::string> modified, std::optional<std::string> published, std::optional<std::vector<std::string>> language, std::optional<std::vector<Contributor>> author, std::optional<std::vector<Contributor>> translator, std::optional<std::vector<Contributor>> editor, std::optional<std::vector<Contributor>> artist, std::optional<std::vector<Contributor>> illustrator, std::optional<std::vector<Contributor>> letterer, std::optional<std::vector<Contributor>> penciler, std::optional<std::vector<Contributor>> colorist, std::optional<std::vector<Contributor>> inker, std::optional<std::vector<Contributor>> narrator, std::optional<std::vector<Contributor>> contributor, std::optional<std::vector<Contributor>> publisher, std::optional<std::vector<Contributor>> imprint, std::optional<std::vector<Subject>> subject, std::optional<std::string> layout, std::optional<std::string> readingProgression, std::optional<std::string> description, std::optional<double> duration, std::optional<double> numberOfPages, std::optional<BelongsTo> belongsTo): title(title), sortAs(sortAs), subtitle(subtitle), identifier(identifier), accessibility(accessibility), modified(modified), published(published), language(language), author(author), translator(translator), editor(editor), artist(artist), illustrator(illustrator), letterer(letterer), penciler(penciler), colorist(colorist), inker(inker), narrator(narrator), contributor(contributor), publisher(publisher), imprint(imprint), subject(subject), layout(layout), readingProgression(readingProgression), description(description), duration(duration), numberOfPages(numberOfPages), belongsTo(belongsTo) {}

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

} // namespace margelo::nitro::readium

namespace margelo::nitro {

  // C++ PublicationMetadata <> JS PublicationMetadata (object)
  template <>
  struct JSIConverter<margelo::nitro::readium::PublicationMetadata> final {
    static inline margelo::nitro::readium::PublicationMetadata fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::readium::PublicationMetadata(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "title"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sortAs"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subtitle"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "identifier"))),
        JSIConverter<std::optional<margelo::nitro::readium::Accessibility>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accessibility"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "modified"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "published"))),
        JSIConverter<std::optional<std::vector<std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "language"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "author"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "translator"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "editor"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "artist"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "illustrator"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "letterer"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "penciler"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "colorist"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "inker"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "narrator"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contributor"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "publisher"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "imprint"))),
        JSIConverter<std::optional<std::vector<margelo::nitro::readium::Subject>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subject"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "layout"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "readingProgression"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "description"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "numberOfPages"))),
        JSIConverter<std::optional<margelo::nitro::readium::BelongsTo>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "belongsTo")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::readium::PublicationMetadata& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "title"), JSIConverter<std::string>::toJSI(runtime, arg.title));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "sortAs"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.sortAs));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "subtitle"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.subtitle));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "identifier"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.identifier));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "accessibility"), JSIConverter<std::optional<margelo::nitro::readium::Accessibility>>::toJSI(runtime, arg.accessibility));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "modified"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.modified));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "published"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.published));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "language"), JSIConverter<std::optional<std::vector<std::string>>>::toJSI(runtime, arg.language));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "author"), JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::toJSI(runtime, arg.author));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "translator"), JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::toJSI(runtime, arg.translator));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "editor"), JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::toJSI(runtime, arg.editor));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "artist"), JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::toJSI(runtime, arg.artist));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "illustrator"), JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::toJSI(runtime, arg.illustrator));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "letterer"), JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::toJSI(runtime, arg.letterer));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "penciler"), JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::toJSI(runtime, arg.penciler));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "colorist"), JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::toJSI(runtime, arg.colorist));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "inker"), JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::toJSI(runtime, arg.inker));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "narrator"), JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::toJSI(runtime, arg.narrator));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "contributor"), JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::toJSI(runtime, arg.contributor));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "publisher"), JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::toJSI(runtime, arg.publisher));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "imprint"), JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::toJSI(runtime, arg.imprint));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "subject"), JSIConverter<std::optional<std::vector<margelo::nitro::readium::Subject>>>::toJSI(runtime, arg.subject));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "layout"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.layout));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "readingProgression"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.readingProgression));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "description"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.description));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "duration"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.duration));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "numberOfPages"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.numberOfPages));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "belongsTo"), JSIConverter<std::optional<margelo::nitro::readium::BelongsTo>>::toJSI(runtime, arg.belongsTo));
      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, "title")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sortAs")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subtitle")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "identifier")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::readium::Accessibility>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "accessibility")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "modified")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "published")))) return false;
      if (!JSIConverter<std::optional<std::vector<std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "language")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "author")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "translator")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "editor")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "artist")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "illustrator")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "letterer")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "penciler")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "colorist")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "inker")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "narrator")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "contributor")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "publisher")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::readium::Contributor>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "imprint")))) return false;
      if (!JSIConverter<std::optional<std::vector<margelo::nitro::readium::Subject>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "subject")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "layout")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "readingProgression")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "description")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "numberOfPages")))) return false;
      if (!JSIConverter<std::optional<margelo::nitro::readium::BelongsTo>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "belongsTo")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
