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

/// 截图回复Tab枚举
enum ScreenshotReplyTab {
  /// 对话分析Tab
  conversationAnalysis(0),

  /// 识图回复Tab
  scanImageReply(1);

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

  const ScreenshotReplyTab(this.tabIndex);

  /// 获取Tab名称
  String getTabName() {
    switch (this) {
      case conversationAnalysis:
        return StringName.intimacyAnalyseTabConversationAnalysis;
      case scanImageReply:
        return StringName.intimacyAnalyseTabScanImageReply;
    }
  }

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