// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_TABS_TAB_GROUP_FEATURES_H_
#define CHROME_BROWSER_UI_TABS_TAB_GROUP_FEATURES_H_

#include <memory>

#include "base/functional/callback.h"

class Profile;
class TabGroupDesktop;
class TabGroupAttentionIndicator;

// This class owns the core controllers for features that are scoped to a tab
// group. It can be subclassed by tests to perform dependency injection.
class TabGroupFeatures {
 public:
  static std::unique_ptr<TabGroupFeatures> CreateTabGroupFeatures();
  virtual ~TabGroupFeatures();

  TabGroupFeatures(const TabGroupFeatures&) = delete;
  TabGroupFeatures& operator=(const TabGroupFeatures&) = delete;

  // Call this method to stub out TabGroupFeatures for tests.
  using TabGroupFeaturesFactory =
      base::RepeatingCallback<std::unique_ptr<TabGroupFeatures>()>;
  static void ReplaceTabGroupFeaturesForTesting(
      TabGroupFeaturesFactory factory);

  // Called exactly once to initialize features.
  virtual void Init(TabGroupDesktop& group, Profile* profile);

  // Public accessors for features, e.g.
  // FooFeature* foo_feature() { return foo_feature_.get(); }
  TabGroupAttentionIndicator* attention_indicator() {
    return attention_indicator_.get();
  }
  TabGroupAttentionIndicator* attention_indicator() const {
    return attention_indicator_.get();
  }

 protected:
  TabGroupFeatures();

 private:
  // Features will each have a controller. e.g.
  // std::unique_ptr<FooFeature> foo_feature_;
  std::unique_ptr<TabGroupAttentionIndicator> attention_indicator_;

  bool initialized_ = false;
};

#endif  // CHROME_BROWSER_UI_TABS_TAB_GROUP_FEATURES_H_
