import '../../../resource/string.gen.dart';

/// 亲密度分析Tab枚举
enum IntimacyAnalyseTab {
  /// 亲密度分析报告Tab
  intimacyAnalyseReport(0),

  /// 截图回复Tab
  intimacyAnalyseScreenshotReply(1);

  /// Tab所在页面的索引
  final int tabIndex;

  const IntimacyAnalyseTab(this.tabIndex);

  /// 获取Tab名称
  String getTabName() {
    switch (this) {
      case intimacyAnalyseReport:
        return StringName.intimacyAnalyseTabReport;
      case intimacyAnalyseScreenshotReply:
        return StringName.intimacyAnalyseTabScreenshotReply;
    }
  }

  /// 通过index，查找对应的Tab枚举实例
  IntimacyAnalyseTab fromIndex(int index) {
    return IntimacyAnalyseTab.values.firstWhere(
      (element) => element.tabIndex == index,
      orElse: () => intimacyAnalyseReport,
    );
  }
}
