import 'package:collection/collection.dart';

/// 性别
enum GenderType {
  /// 男
  male(1),

  /// 女
  female(2);

  final int type;

  const GenderType(this.type);

  /// 通过状态字符串，获取对应的状态枚举
  static GenderType? fromType(int? type) {
    if (type == null) {
      return null;
    }
    return values.firstWhereOrNull((e) => e.type == type);
  }

  @override
  String toString() => type.toString();
}
