class Session { final String id; final int index; final String name; final String type; // "claude" or "terminal" final String? kind; // "api" or "visual" final bool isActive; const Session({ required this.id, required this.index, required this.name, required this.type, this.kind, this.isActive = false, }); Session copyWith({ String? name, bool? isActive, String? kind, }) { return Session( id: id, index: index, name: name ?? this.name, type: type, kind: kind ?? this.kind, isActive: isActive ?? this.isActive, ); } Map toJson() { return { 'id': id, 'index': index, 'name': name, 'type': type, if (kind != null) 'kind': kind, 'isActive': isActive, }; } factory Session.fromJson(Map json) { return Session( id: json['id'] as String? ?? 'session-${json['index']}', index: json['index'] as int? ?? 0, name: json['name'] as String? ?? 'Session', type: json['type'] as String? ?? 'claude', kind: json['kind'] as String?, isActive: json['isActive'] as bool? ?? false, ); } /// Icon for this session type. String get icon { if (type == 'terminal') return '\u{1F4BB}'; // laptop if (kind == 'api') return '\u{1F916}'; // robot return '\u{1F4AC}'; // speech bubble } }