import 'package:get/get.dart';
import 'package:loopin/models/tab_type.dart';

class TabBarController extends GetxController {
  final RxMap<String, int> badgeMap = <String, int>{
    TabType.chat.name: 0,
    TabType.my.name: 0,
  }.obs;

  /// 设置角标数量
  void setBadge(TabType tab, int count) {
    badgeMap[tab.name] = count;
  }

  void clearBadge(TabType tab) {
    badgeMap[tab.name] = 0;
  }

  void clearAllBadges() {
    badgeMap.clear();
  }

  int getBadge(TabType tab) {
    return badgeMap[tab.name] ?? 0;
  }
}
