///
/// PaymentResult.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 `PaymentTypes` to properly resolve imports.
namespace margelo::nitro::taponpagseguro { enum class PaymentTypes; }
// Forward declaration of `InstallmentTypes` to properly resolve imports.
namespace margelo::nitro::taponpagseguro { enum class InstallmentTypes; }

#include "PaymentTypes.hpp"
#include <string>
#include "InstallmentTypes.hpp"

namespace margelo::nitro::taponpagseguro {

  /**
   * A struct which can be represented as a JavaScript object (PaymentResult).
   */
  struct PaymentResult final {
  public:
    double amount     SWIFT_PRIVATE;
    double raw_amount     SWIFT_PRIVATE;
    PaymentTypes payment_method     SWIFT_PRIVATE;
    std::string transaction_code     SWIFT_PRIVATE;
    std::string transaction_date_time     SWIFT_PRIVATE;
    std::string card_holder     SWIFT_PRIVATE;
    std::string card_brand     SWIFT_PRIVATE;
    double installments     SWIFT_PRIVATE;
    double installment_value     SWIFT_PRIVATE;
    double raw_installment_value     SWIFT_PRIVATE;
    InstallmentTypes installment_method     SWIFT_PRIVATE;
    bool is_sale_with_taxpass_through     SWIFT_PRIVATE;

  public:
    PaymentResult() = default;
    explicit PaymentResult(double amount, double raw_amount, PaymentTypes payment_method, std::string transaction_code, std::string transaction_date_time, std::string card_holder, std::string card_brand, double installments, double installment_value, double raw_installment_value, InstallmentTypes installment_method, bool is_sale_with_taxpass_through): amount(amount), raw_amount(raw_amount), payment_method(payment_method), transaction_code(transaction_code), transaction_date_time(transaction_date_time), card_holder(card_holder), card_brand(card_brand), installments(installments), installment_value(installment_value), raw_installment_value(raw_installment_value), installment_method(installment_method), is_sale_with_taxpass_through(is_sale_with_taxpass_through) {}

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

} // namespace margelo::nitro::taponpagseguro

namespace margelo::nitro {

  // C++ PaymentResult <> JS PaymentResult (object)
  template <>
  struct JSIConverter<margelo::nitro::taponpagseguro::PaymentResult> final {
    static inline margelo::nitro::taponpagseguro::PaymentResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return margelo::nitro::taponpagseguro::PaymentResult(
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amount"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "raw_amount"))),
        JSIConverter<margelo::nitro::taponpagseguro::PaymentTypes>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "payment_method"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "transaction_code"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "transaction_date_time"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "card_holder"))),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "card_brand"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "installments"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "installment_value"))),
        JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "raw_installment_value"))),
        JSIConverter<margelo::nitro::taponpagseguro::InstallmentTypes>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "installment_method"))),
        JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "is_sale_with_taxpass_through")))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::taponpagseguro::PaymentResult& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "amount"), JSIConverter<double>::toJSI(runtime, arg.amount));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "raw_amount"), JSIConverter<double>::toJSI(runtime, arg.raw_amount));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "payment_method"), JSIConverter<margelo::nitro::taponpagseguro::PaymentTypes>::toJSI(runtime, arg.payment_method));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "transaction_code"), JSIConverter<std::string>::toJSI(runtime, arg.transaction_code));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "transaction_date_time"), JSIConverter<std::string>::toJSI(runtime, arg.transaction_date_time));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "card_holder"), JSIConverter<std::string>::toJSI(runtime, arg.card_holder));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "card_brand"), JSIConverter<std::string>::toJSI(runtime, arg.card_brand));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "installments"), JSIConverter<double>::toJSI(runtime, arg.installments));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "installment_value"), JSIConverter<double>::toJSI(runtime, arg.installment_value));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "raw_installment_value"), JSIConverter<double>::toJSI(runtime, arg.raw_installment_value));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "installment_method"), JSIConverter<margelo::nitro::taponpagseguro::InstallmentTypes>::toJSI(runtime, arg.installment_method));
      obj.setProperty(runtime, PropNameIDCache::get(runtime, "is_sale_with_taxpass_through"), JSIConverter<bool>::toJSI(runtime, arg.is_sale_with_taxpass_through));
      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<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "amount")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "raw_amount")))) return false;
      if (!JSIConverter<margelo::nitro::taponpagseguro::PaymentTypes>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "payment_method")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "transaction_code")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "transaction_date_time")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "card_holder")))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "card_brand")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "installments")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "installment_value")))) return false;
      if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "raw_installment_value")))) return false;
      if (!JSIConverter<margelo::nitro::taponpagseguro::InstallmentTypes>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "installment_method")))) return false;
      if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "is_sale_with_taxpass_through")))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
