class Channel { final String id; final String guildId; final String categoryId; final String name; final String type; final String? topic; final int position; final DateTime createdAt; Channel({ required this.id, required this.guildId, this.categoryId = '', required this.name, this.type = 'text', this.topic, this.position = 0, DateTime? createdAt, }) : createdAt = createdAt ?? DateTime.now(); factory Channel.fromJson(Map json) { return Channel( id: json['id'] as String, guildId: json['guild_id'] as String, categoryId: json['category_id'] as String? ?? '', name: json['name'] as String, type: json['type'] as String? ?? 'text', topic: json['topic'] as String?, position: json['position'] as int? ?? 0, createdAt: json['created_at'] != null ? DateTime.parse(json['created_at'] as String) : DateTime.now(), ); } bool get isText => type == 'text'; bool get isVoice => type == 'voice'; bool get isStream => type == 'stream'; }