///
/// ThorShape.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 `ThorShapeType` to properly resolve imports.
namespace margelo::nitro::thor { enum class ThorShapeType; }

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

namespace margelo::nitro::thor {

  /**
   * A struct which can be represented as a JavaScript object (ThorShape).
   */
  struct ThorShape final {
  public:
    ThorShapeType type     SWIFT_PRIVATE;
    std::optional<std::string> fill     SWIFT_PRIVATE;
    std::optional<std::string> stroke     SWIFT_PRIVATE;
    std::optional<double> strokeWidth     SWIFT_PRIVATE;
    std::optional<double> x     SWIFT_PRIVATE;
    std::optional<double> y     SWIFT_PRIVATE;
    std::optional<double> width     SWIFT_PRIVATE;
    std::optional<double> height     SWIFT_PRIVATE;
    std::optional<double> rx     SWIFT_PRIVATE;
    std::optional<double> ry     SWIFT_PRIVATE;
    std::optional<double> cx     SWIFT_PRIVATE;
    std::optional<double> cy     SWIFT_PRIVATE;
    std::optional<double> radius     SWIFT_PRIVATE;
    std::optional<double> x1     SWIFT_PRIVATE;
    std::optional<double> y1     SWIFT_PRIVATE;
    std::optional<double> x2     SWIFT_PRIVATE;
    std::optional<double> y2     SWIFT_PRIVATE;
    std::optional<std::vector<double>> points     SWIFT_PRIVATE;
    std::optional<bool> closed     SWIFT_PRIVATE;

  public:
    ThorShape() = default;
    explicit ThorShape(ThorShapeType type, std::optional<std::string> fill, std::optional<std::string> stroke, std::optional<double> strokeWidth, std::optional<double> x, std::optional<double> y, std::optional<double> width, std::optional<double> height, std::optional<double> rx, std::optional<double> ry, std::optional<double> cx, std::optional<double> cy, std::optional<double> radius, std::optional<double> x1, std::optional<double> y1, std::optional<double> x2, std::optional<double> y2, std::optional<std::vector<double>> points, std::optional<bool> closed): type(type), fill(fill), stroke(stroke), strokeWidth(strokeWidth), x(x), y(y), width(width), height(height), rx(rx), ry(ry), cx(cx), cy(cy), radius(radius), x1(x1), y1(y1), x2(x2), y2(y2), points(points), closed(closed) {}

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

} // namespace margelo::nitro::thor

namespace margelo::nitro {

  // C++ ThorShape <> JS ThorShape (object)
  template <>
  struct JSIConverter<margelo::nitro::thor::ThorShape> final {
    static inline margelo::nitro::thor::ThorShape fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::thor::ThorShape(
        JSIConverter<margelo::nitro::thor::ThorShapeType>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fill"))),
        JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stroke"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "strokeWidth"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rx"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ry"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cx"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cy"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "radius"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x1"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y1"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x2"))),
        JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y2"))),
        JSIConverter<std::optional<std::vector<double>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "points"))),
        JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "closed")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::thor::ThorShape& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<margelo::nitro::thor::ThorShapeType>::toJSI(runtime, arg.type));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "fill"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.fill));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "stroke"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.stroke));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "strokeWidth"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.strokeWidth));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "x"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.x));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "y"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.y));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "width"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.width));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "height"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.height));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "rx"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.rx));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "ry"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.ry));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "cx"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.cx));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "cy"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.cy));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "radius"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.radius));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "x1"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.x1));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "y1"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.y1));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "x2"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.x2));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "y2"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.y2));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "points"), JSIConverter<std::optional<std::vector<double>>>::toJSI(runtime, arg.points));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "closed"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.closed));
      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::thor::ThorShapeType>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fill")))) return false;
      if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "stroke")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "strokeWidth")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "width")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "height")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "rx")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "ry")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cx")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cy")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "radius")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x1")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y1")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "x2")))) return false;
      if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "y2")))) return false;
      if (!JSIConverter<std::optional<std::vector<double>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "points")))) return false;
      if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "closed")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
