///
/// ModalTransitionStyle.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/NitroHash.hpp>)
#include <NitroModules/NitroHash.hpp>
#else
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
#endif
#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

namespace margelo::nitro::inappbrowsernitro {

  /**
   * An enum which can be represented as a JavaScript union (ModalTransitionStyle).
   */
  enum class ModalTransitionStyle {
    COVERVERTICAL      SWIFT_NAME(coververtical) = 0,
    FLIPHORIZONTAL      SWIFT_NAME(fliphorizontal) = 1,
    CROSSDISSOLVE      SWIFT_NAME(crossdissolve) = 2,
    PARTIALCURL      SWIFT_NAME(partialcurl) = 3,
  } CLOSED_ENUM;

} // namespace margelo::nitro::inappbrowsernitro

namespace margelo::nitro {

  // C++ ModalTransitionStyle <> JS ModalTransitionStyle (union)
  template <>
  struct JSIConverter<margelo::nitro::inappbrowsernitro::ModalTransitionStyle> final {
    static inline margelo::nitro::inappbrowsernitro::ModalTransitionStyle fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
      switch (hashString(unionValue.c_str(), unionValue.size())) {
        case hashString("coverVertical"): return margelo::nitro::inappbrowsernitro::ModalTransitionStyle::COVERVERTICAL;
        case hashString("flipHorizontal"): return margelo::nitro::inappbrowsernitro::ModalTransitionStyle::FLIPHORIZONTAL;
        case hashString("crossDissolve"): return margelo::nitro::inappbrowsernitro::ModalTransitionStyle::CROSSDISSOLVE;
        case hashString("partialCurl"): return margelo::nitro::inappbrowsernitro::ModalTransitionStyle::PARTIALCURL;
        default: [[unlikely]]
          throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum ModalTransitionStyle - invalid value!");
      }
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::inappbrowsernitro::ModalTransitionStyle arg) {
      switch (arg) {
        case margelo::nitro::inappbrowsernitro::ModalTransitionStyle::COVERVERTICAL: return JSIConverter<std::string>::toJSI(runtime, "coverVertical");
        case margelo::nitro::inappbrowsernitro::ModalTransitionStyle::FLIPHORIZONTAL: return JSIConverter<std::string>::toJSI(runtime, "flipHorizontal");
        case margelo::nitro::inappbrowsernitro::ModalTransitionStyle::CROSSDISSOLVE: return JSIConverter<std::string>::toJSI(runtime, "crossDissolve");
        case margelo::nitro::inappbrowsernitro::ModalTransitionStyle::PARTIALCURL: return JSIConverter<std::string>::toJSI(runtime, "partialCurl");
        default: [[unlikely]]
          throw std::invalid_argument("Cannot convert ModalTransitionStyle to JS - invalid value: "
                                    + std::to_string(static_cast<int>(arg)) + "!");
      }
    }
    static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
      if (!value.isString()) {
        return false;
      }
      std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
      switch (hashString(unionValue.c_str(), unionValue.size())) {
        case hashString("coverVertical"):
        case hashString("flipHorizontal"):
        case hashString("crossDissolve"):
        case hashString("partialCurl"):
          return true;
        default:
          return false;
      }
    }
  };

} // namespace margelo::nitro
