///
/// HybridVideoViewComponent.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 "ResizeMode.hpp"
#include <functional>
#include "SurfaceType.hpp"
#include "VideoTrackSelection.hpp"
#include "SubtitleTrackSelection.hpp"
#include "AudioTrackSelection.hpp"
#include <string>
#include "VideoSource.hpp"
#include <memory>
#include "HybridVideoViewSpec.hpp"
#include <optional>

namespace margelo::nitro::aviation::views {

  using namespace facebook;

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

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

  public:
    CachedProp<ResizeMode> resizeMode;
    CachedProp<bool> pipEnabled;
    CachedProp<bool> playInBackground;
    CachedProp<std::function<void()>> onPipStart;
    CachedProp<std::function<void()>> onPipStop;
    CachedProp<SurfaceType> surfaceType;
    CachedProp<std::function<void()>> onFullscreenEnter;
    CachedProp<std::function<void()>> onFullscreenExit;
    CachedProp<VideoTrackSelection> selectedVideoTrack;
    CachedProp<SubtitleTrackSelection> selectedSubtitleTrack;
    CachedProp<AudioTrackSelection> selectedAudioTrack;
    CachedProp<std::string> adTagUrl;
    CachedProp<VideoSource> source;
    CachedProp<bool> autoPlay;
    CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridVideoViewSpec>& /* ref */)>>> hybridRef;

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

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

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

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

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

  /**
   * The Shadow Node for the "VideoView" View.
   */
  using HybridVideoViewShadowNode = react::ConcreteViewShadowNode<HybridVideoViewComponentName /* "HybridVideoView" */,
                                                                  HybridVideoViewProps /* custom props */,
                                                                  react::ViewEventEmitter /* default */,
                                                                  HybridVideoViewState /* custom state */>;

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

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

} // namespace margelo::nitro::aviation::views
