26 lines
647 B
Dart
26 lines
647 B
Dart
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<String, dynamic> 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,
|
|
);
|
|
}
|
|
}
|