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

class ErrorCode {
  /// 登录相关错误码
  static const int verificationCodeError = 2002; //验证码错误
  static const int noLoginError = 1006; //未登录
  static const int noMember = 1005; //没有会员
  static const int sensitive = 1023; //敏感内容

  /// 会员服务相关错误码

  static const int isMember = 1301; //您已经是会员了
  static const int payOrderError = 1004;
}

/// 错误码扩展方法
extension ErrorDescription on int {
  String? get description {
    switch (this) {
      case ErrorCode.verificationCodeError:
        return StringName.loginVerificationCodeRequestFailedToast;
      case ErrorCode.noLoginError:
        return StringName.accountNoLogin;
      case ErrorCode.sensitive:
        return StringName.sensitiveContent;
      default:
        return null;
    }
  }
}
