enum SCErroCode {
  userNotRegistered(4000),
  passwordNotRules(4061),
  authUnauthorized(401),
  redPacketFinished(3262),
  userJoinedFamily(2518),
  orderExistsCreated(5900),
  unknown(-1);

  final int code;
  const SCErroCode(this.code);

  static SCErroCode fromCode(int code) {
    return SCErroCode.values.firstWhere(
          (e) => e.code == code,
      orElse: () => SCErroCode.unknown, // 避免 StateError
    );
  }
}