import '../sessions/session.dart'; class Project { Project({ required this.projectId, required this.name, required this.workingDirectory, required this.createdAtUtc, required this.updatedAtUtc, }); final String projectId; final String name; final String workingDirectory; final DateTime createdAtUtc; final DateTime updatedAtUtc; factory Project.fromJson(Map json) => Project( projectId: json['projectId'] as String, name: json['name'] as String, workingDirectory: json['workingDirectory'] as String, createdAtUtc: DateTime.parse(json['createdAtUtc'] as String), updatedAtUtc: DateTime.parse(json['updatedAtUtc'] as String), ); } class ProjectDetail { ProjectDetail({required this.project, required this.recentSessions}); final Project project; final List recentSessions; factory ProjectDetail.fromJson(Map json) => ProjectDetail( project: Project.fromJson(json), recentSessions: ((json['recentSessions'] as List?) ?? const []) .map( (entry) => Session.fromJson(Map.from(entry as Map)), ) .toList(growable: false), ); }