class PrinterDrive {
  String id;
  String name;
  String? fileToken;
  int? size;
  String? manufacturer;
  String? version;
  List<String>? supportedPrinterModels;

  String get sizeString =>
      (size ?? 0 / 1024.0 / 1024.0).toStringAsFixed(2) + 'MB';

  String? supportedPlatform;

  String? filePath;

  DateTime? createTime;

  String? ipAddress;

  PrinterDrive({
    required this.id,
    required this.name,
    this.fileToken,
    this.size,
    this.manufacturer,
    this.version,
    this.supportedPrinterModels,
    this.supportedPlatform,
    this.filePath,
    this.createTime,
    this.ipAddress,
  });

  Map<String, dynamic> toJson() => <String, dynamic>{
        'id': id,
        'name': name,
        'fileToken': fileToken ?? '',
        'size': size ?? '',
        'manufacturer': manufacturer ?? '',
        'version': version ?? '',
        'supportedPlatform': supportedPlatform ?? '',
        'filePath': filePath ?? '',
        'createTime': createTime?.toIso8601String(),
        'IPAddress': ipAddress ?? '',
        'supportedPrinterModels':
            supportedPrinterModels?.map((e) => e.toString()).toList(),
      };
}
