///
/// HybridBlurViewGroupComponent.hpp
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///

#pragma once

#include <optional>
#include <NitroModules/NitroDefines.hpp>
#include <NitroModules/NitroHash.hpp>
#include <NitroModules/CachedProp.hpp>
#include <react/renderer/core/ConcreteComponentDescriptor.h>
#include <react/renderer/core/PropsParserContext.h>
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
#include <react/renderer/components/view/ViewProps.h>

#include <optional>
#include <string>
#include <memory>
#include "HybridBlurViewGroupSpec.hpp"
#include <functional>

namespace margelo::nitro::qmblurview::views {

  using namespace facebook;

  /**
   * The name of the actual native View.
   */
  extern const char HybridBlurViewGroupComponentName[];

  /**
   * Props for the "BlurViewGroup" View.
   */
  class HybridBlurViewGroupProps final: public react::ViewProps {
  public:
    HybridBlurViewGroupProps() = default;
    HybridBlurViewGroupProps(const HybridBlurViewGroupProps&);
    HybridBlurViewGroupProps(const react::PropsParserContext& context,
                             const HybridBlurViewGroupProps& sourceProps,
                             const react::RawProps& rawProps);

  public:
    CachedProp<std::optional<double>> blurRadius;
    CachedProp<std::optional<double>> cornerRadius;
    CachedProp<std::optional<double>> blurRounds;
    CachedProp<std::optional<std::string>> overlayColor;
    CachedProp<std::optional<double>> downsampleFactor;
    CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridBlurViewGroupSpec>& /* ref */)>>> hybridRef;

  private:
    static bool filterObjectKeys(const std::string& propName);
  };

  /**
   * State for the "BlurViewGroup" View.
   */
  class HybridBlurViewGroupState final {
  public:
    HybridBlurViewGroupState() = default;

  public:
    void setProps(const HybridBlurViewGroupProps& props) { _props.emplace(props); }
    const std::optional<HybridBlurViewGroupProps>& getProps() const { return _props; }

  public:
#ifdef ANDROID
  HybridBlurViewGroupState(const HybridBlurViewGroupState& /* previousState */, folly::dynamic /* data */) {}
  folly::dynamic getDynamic() const {
    throw std::runtime_error("HybridBlurViewGroupState does not support folly!");
  }
  react::MapBuffer getMapBuffer() const {
    throw std::runtime_error("HybridBlurViewGroupState does not support MapBuffer!");
  };
#endif

  private:
    std::optional<HybridBlurViewGroupProps> _props;
  };

  /**
   * The Shadow Node for the "BlurViewGroup" View.
   */
  using HybridBlurViewGroupShadowNode = react::ConcreteViewShadowNode<HybridBlurViewGroupComponentName /* "HybridBlurViewGroup" */,
                                                                      HybridBlurViewGroupProps /* custom props */,
                                                                      react::ViewEventEmitter /* default */,
                                                                      HybridBlurViewGroupState /* custom state */>;

  /**
   * The Component Descriptor for the "BlurViewGroup" View.
   */
  class HybridBlurViewGroupComponentDescriptor final: public react::ConcreteComponentDescriptor<HybridBlurViewGroupShadowNode> {
  public:
    HybridBlurViewGroupComponentDescriptor(const react::ComponentDescriptorParameters& parameters);

  public:
    /**
     * A faster path for cloning props - reuses the caching logic from `HybridBlurViewGroupProps`.
     */
    std::shared_ptr<const react::Props> cloneProps(const react::PropsParserContext& context,
                                                   const std::shared_ptr<const react::Props>& props,
                                                   react::RawProps rawProps) const override;
#ifdef ANDROID
    void adopt(react::ShadowNode& shadowNode) const override;
#endif
  };

  /* The actual view for "BlurViewGroup" needs to be implemented in platform-specific code. */

} // namespace margelo::nitro::qmblurview::views
