class DashboardSummary { final int totalDevices; final int totalLaptops; final int totalDesktops; final int totalServers; final int printersWithSerial; final int printersWithoutSerial; final int drivesFailing; DashboardSummary({ required this.totalDevices, required this.totalLaptops, required this.totalDesktops, required this.totalServers, required this.printersWithSerial, required this.printersWithoutSerial, required this.drivesFailing, }); factory DashboardSummary.fromJson(Map json) { return DashboardSummary( totalDevices: json['totalDevices'] ?? 0, totalLaptops: json['totalLaptops'] ?? 0, totalDesktops: json['totalDesktops'] ?? 0, totalServers: json['totalServers'] ?? 0, printersWithSerial: json['printersWithSerial'] ?? 0, printersWithoutSerial: json['printersWithoutSerial'] ?? 0, drivesFailing: json['drivesFailing'] ?? 0, ); } } class ChartDataPoint { final String label; final int count; ChartDataPoint({required this.label, required this.count}); factory ChartDataPoint.fromJson(Map json, {String labelKey = 'label', String countKey = 'count'}) { return ChartDataPoint( label: json[labelKey]?.toString() ?? 'Unknown', count: json[countKey] ?? 0, ); } }