///
/// BillItems.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © 2025 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



#include <string>

namespace margelo::nitro::fawrypay_rnfawrypaysdk {

  /**
   * A struct which can be represented as a JavaScript object (BillItems).
   */
  struct BillItems {
  public:
    std::string itemId     SWIFT_PRIVATE;
    std::string description     SWIFT_PRIVATE;
    std::string quantity     SWIFT_PRIVATE;
    std::string price     SWIFT_PRIVATE;

  public:
    BillItems() = default;
    explicit BillItems(std::string itemId, std::string description, std::string quantity, std::string price): itemId(itemId), description(description), quantity(quantity), price(price) {}
  };

} // namespace margelo::nitro::fawrypay_rnfawrypaysdk

namespace margelo::nitro {

  using namespace margelo::nitro::fawrypay_rnfawrypaysdk;

  // C++ BillItems <> JS BillItems (object)
  template <>
  struct JSIConverter<BillItems> final {
    static inline BillItems fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      jsi::Object obj = arg.asObject(runtime);
      return BillItems(
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "itemId")),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "description")),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "quantity")),
        JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "price"))
      );
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, const BillItems& arg) {
      jsi::Object obj(runtime);
      obj.setProperty(runtime, "itemId", JSIConverter<std::string>::toJSI(runtime, arg.itemId));
      obj.setProperty(runtime, "description", JSIConverter<std::string>::toJSI(runtime, arg.description));
      obj.setProperty(runtime, "quantity", JSIConverter<std::string>::toJSI(runtime, arg.quantity));
      obj.setProperty(runtime, "price", JSIConverter<std::string>::toJSI(runtime, arg.price));
      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 (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "itemId"))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "description"))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "quantity"))) return false;
      if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "price"))) return false;
      return true;
    }
  };

} // namespace margelo::nitro
