class GroupMember {
  final String userId;
  final String username;
  final String role; // 'MANAGER' | 'MEMBER'
  final bool isOnline;

  const GroupMember({
    required this.userId,
    required this.username,
    this.role = 'MEMBER',
    this.isOnline = false,
  });

  factory GroupMember.fromJson(Map<String, dynamic> json) {
    return GroupMember(
      userId: json['user_id'].toString(),
      username: json['username'] as String,
      role: (json['role'] as String?) ?? 'MEMBER',
      isOnline: (json['is_online'] as bool?) ?? false,
    );
  }

  bool get isManager => role == 'MANAGER';
}
