class Channel { final String id; final String name; final String type; // 'PUBLIC' | 'PRIVATE' | 'DIRECT' final bool isActive; final int memberCount; const Channel({ required this.id, required this.name, this.type = 'PUBLIC', this.isActive = true, this.memberCount = 0, }); factory Channel.fromJson(Map json) { return Channel( id: json['id'].toString(), name: json['name'] as String, type: (json['type'] as String?) ?? 'PUBLIC', isActive: (json['is_active'] as bool?) ?? true, memberCount: (json['member_count'] ?? json['members'] ?? 0) as int, ); } }