#pragma once

#include <frostbite2D/2d/actor.h>
#include <frostbite2D/event/event.h>
#include <frostbite2D/graphics/render_style.h>
#include <vector>

namespace frostbite2D {

class Scene : public Actor {
public:
  Scene();
  virtual ~Scene();

  virtual void onEnter();
  virtual void onExit();

  void Update(float deltaTime) override;
  void Render() override;

  bool OnEvent(const Event& event) override;
  /**
   * @brief 为当前场景指定渲染风格预设
   */
  void SetRenderStyleProfile(RenderStyleProfileId profile);
  /**
   * @brief 清除场景级渲染风格覆盖，回退到应用默认值
   */
  void ClearRenderStyleProfileOverride();
  bool HasRenderStyleProfileOverride() const { return hasRenderStyleProfileOverride_; }
  /**
   * @brief 解析当前场景最终应使用的渲染风格
   */
  RenderStyleProfileId ResolveRenderStyleProfile(
      RenderStyleProfileId defaultProfile) const;
  
  static Scene* GetCurrent();

private:
  bool dispatchToChildren(const Event& event);
  
  static Scene* current_;
  bool hasRenderStyleProfileOverride_ = false;
  RenderStyleProfileId renderStyleProfileOverride_ = RenderStyleProfileId::Hybrid2D;

  friend class SceneManager;
};

}
