///
/// StateOfMindAssociation.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

namespace margelo::nitro::healthkit {

  /**
   * An enum which can be represented as a JavaScript enum (StateOfMindAssociation).
   */
  enum class StateOfMindAssociation {
    COMMUNITY      SWIFT_NAME(community) = 1,
    CURRENTEVENTS      SWIFT_NAME(currentevents) = 2,
    DATING      SWIFT_NAME(dating) = 3,
    EDUCATION      SWIFT_NAME(education) = 4,
    FAMILY      SWIFT_NAME(family) = 5,
    FITNESS      SWIFT_NAME(fitness) = 6,
    FRIENDS      SWIFT_NAME(friends) = 7,
    HEALTH      SWIFT_NAME(health) = 8,
    HOBBIES      SWIFT_NAME(hobbies) = 9,
    IDENTITY      SWIFT_NAME(identity) = 10,
    MONEY      SWIFT_NAME(money) = 11,
    PARTNER      SWIFT_NAME(partner) = 12,
    SELFCARE      SWIFT_NAME(selfcare) = 13,
    SPIRITUALITY      SWIFT_NAME(spirituality) = 14,
    TASKS      SWIFT_NAME(tasks) = 15,
    TRAVEL      SWIFT_NAME(travel) = 16,
    WORK      SWIFT_NAME(work) = 17,
    WEATHER      SWIFT_NAME(weather) = 18,
  } CLOSED_ENUM;

} // namespace margelo::nitro::healthkit

namespace margelo::nitro {

  // C++ StateOfMindAssociation <> JS StateOfMindAssociation (enum)
  template <>
  struct JSIConverter<margelo::nitro::healthkit::StateOfMindAssociation> final {
    static inline margelo::nitro::healthkit::StateOfMindAssociation fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
      int enumValue = JSIConverter<int>::fromJSI(runtime, arg);
      return static_cast<margelo::nitro::healthkit::StateOfMindAssociation>(enumValue);
    }
    static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::healthkit::StateOfMindAssociation arg) {
      int enumValue = static_cast<int>(arg);
      return JSIConverter<int>::toJSI(runtime, enumValue);
    }
    static inline bool canConvert(jsi::Runtime&, const jsi::Value& value) {
      if (!value.isNumber()) {
        return false;
      }
      double number = value.getNumber();
      int integer = static_cast<int>(number);
      if (number != integer) {
        // The integer is not the same value as the double - we truncated floating points.
        // Enums are all integers, so the input floating point number is obviously invalid.
        return false;
      }
      // Check if we are within the bounds of the enum.
      return integer >= 1 && integer <= 18;
    }
  };

} // namespace margelo::nitro
