///
/// HybridUiListViewComponent.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 <memory>
#include "HybridUiListViewSpec.hpp"
#include <functional>
#include <optional>

namespace margelo::nitro::reactnativelist::views {

  using namespace facebook;

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

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

  public:
    CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridUiListViewSpec>& /* ref */)>>> hybridRef;

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

  /**
   * State for the "UiListView" View.
   */
  class HybridUiListViewState final {
  public:
    HybridUiListViewState() = default;
    explicit HybridUiListViewState(const std::shared_ptr<HybridUiListViewProps>& props):
      _props(props) {}

  public:
    [[nodiscard]]
    const std::shared_ptr<HybridUiListViewProps>& getProps() const {
      return _props;
    }

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

  private:
    std::shared_ptr<HybridUiListViewProps> _props;
  };

  /**
   * The Shadow Node for the "UiListView" View.
   */
  using HybridUiListViewShadowNode = react::ConcreteViewShadowNode<HybridUiListViewComponentName /* "HybridUiListView" */,
                                                                   HybridUiListViewProps /* custom props */,
                                                                   react::ViewEventEmitter /* default */,
                                                                   HybridUiListViewState /* custom state */>;

  /**
   * The Component Descriptor for the "UiListView" View.
   */
  class HybridUiListViewComponentDescriptor final: public react::ConcreteComponentDescriptor<HybridUiListViewShadowNode> {
  public:
    explicit HybridUiListViewComponentDescriptor(const react::ComponentDescriptorParameters& parameters);

  public:
    /**
     * A faster path for cloning props - reuses the caching logic from `HybridUiListViewProps`.
     */
    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 "UiListView" needs to be implemented in platform-specific code. */

} // namespace margelo::nitro::reactnativelist::views
