///
/// ModalPresentationStyle.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 (ModalPresentationStyle).
   */
  enum class ModalPresentationStyle {
    AUTOMATIC      SWIFT_NAME(automatic) = 0,
    NONE      SWIFT_NAME(none) = 1,
    FULLSCREEN      SWIFT_NAME(fullscreen) = 2,
    PAGESHEET      SWIFT_NAME(pagesheet) = 3,
    FORMSHEET      SWIFT_NAME(formsheet) = 4,
    CURRENTCONTEXT      SWIFT_NAME(currentcontext) = 5,
    CUSTOM      SWIFT_NAME(custom) = 6,
    OVERFULLSCREEN      SWIFT_NAME(overfullscreen) = 7,
    OVERCURRENTCONTEXT      SWIFT_NAME(overcurrentcontext) = 8,
    POPOVER      SWIFT_NAME(popover) = 9,
  } CLOSED_ENUM;

} // namespace margelo::nitro::inappbrowsernitro

namespace margelo::nitro {

  // C++ ModalPresentationStyle <> JS ModalPresentationStyle (union)
  template <>
  struct JSIConverter<margelo::nitro::inappbrowsernitro::ModalPresentationStyle> final {
    static inline margelo::nitro::inappbrowsernitro::ModalPresentationStyle 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("automatic"): return margelo::nitro::inappbrowsernitro::ModalPresentationStyle::AUTOMATIC;
        case hashString("none"): return margelo::nitro::inappbrowsernitro::ModalPresentationStyle::NONE;
        case hashString("fullScreen"): return margelo::nitro::inappbrowsernitro::ModalPresentationStyle::FULLSCREEN;
        case hashString("pageSheet"): return margelo::nitro::inappbrowsernitro::ModalPresentationStyle::PAGESHEET;
        case hashString("formSheet"): return margelo::nitro::inappbrowsernitro::ModalPresentationStyle::FORMSHEET;
        case hashString("currentContext"): return margelo::nitro::inappbrowsernitro::ModalPresentationStyle::CURRENTCONTEXT;
        case hashString("custom"): return margelo::nitro::inappbrowsernitro::ModalPresentationStyle::CUSTOM;
        case hashString("overFullScreen"): return margelo::nitro::inappbrowsernitro::ModalPresentationStyle::OVERFULLSCREEN;
        case hashString("overCurrentContext"): return margelo::nitro::inappbrowsernitro::ModalPresentationStyle::OVERCURRENTCONTEXT;
        case hashString("popover"): return margelo::nitro::inappbrowsernitro::ModalPresentationStyle::POPOVER;
        default: [[unlikely]]
          throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum ModalPresentationStyle - invalid value!");
      }
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::inappbrowsernitro::ModalPresentationStyle arg) {
      switch (arg) {
        case margelo::nitro::inappbrowsernitro::ModalPresentationStyle::AUTOMATIC: return JSIConverter<std::string>::toJSI(runtime, "automatic");
        case margelo::nitro::inappbrowsernitro::ModalPresentationStyle::NONE: return JSIConverter<std::string>::toJSI(runtime, "none");
        case margelo::nitro::inappbrowsernitro::ModalPresentationStyle::FULLSCREEN: return JSIConverter<std::string>::toJSI(runtime, "fullScreen");
        case margelo::nitro::inappbrowsernitro::ModalPresentationStyle::PAGESHEET: return JSIConverter<std::string>::toJSI(runtime, "pageSheet");
        case margelo::nitro::inappbrowsernitro::ModalPresentationStyle::FORMSHEET: return JSIConverter<std::string>::toJSI(runtime, "formSheet");
        case margelo::nitro::inappbrowsernitro::ModalPresentationStyle::CURRENTCONTEXT: return JSIConverter<std::string>::toJSI(runtime, "currentContext");
        case margelo::nitro::inappbrowsernitro::ModalPresentationStyle::CUSTOM: return JSIConverter<std::string>::toJSI(runtime, "custom");
        case margelo::nitro::inappbrowsernitro::ModalPresentationStyle::OVERFULLSCREEN: return JSIConverter<std::string>::toJSI(runtime, "overFullScreen");
        case margelo::nitro::inappbrowsernitro::ModalPresentationStyle::OVERCURRENTCONTEXT: return JSIConverter<std::string>::toJSI(runtime, "overCurrentContext");
        case margelo::nitro::inappbrowsernitro::ModalPresentationStyle::POPOVER: return JSIConverter<std::string>::toJSI(runtime, "popover");
        default: [[unlikely]]
          throw std::invalid_argument("Cannot convert ModalPresentationStyle 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("automatic"):
        case hashString("none"):
        case hashString("fullScreen"):
        case hashString("pageSheet"):
        case hashString("formSheet"):
        case hashString("currentContext"):
        case hashString("custom"):
        case hashString("overFullScreen"):
        case hashString("overCurrentContext"):
        case hashString("popover"):
          return true;
        default:
          return false;
      }
    }
  };

} // namespace margelo::nitro
