import 'package:toolbox/data/model/server/private_key_info.dart'; import 'package:toolbox/data/model/server/server_private_info.dart'; import 'package:toolbox/data/model/server/snippet.dart'; class Backup { // backup format version final int version; final String date; final List spis; final List snippets; final List keys; final Map dockerHosts; final Map settings; Backup({ required this.version, required this.date, required this.spis, required this.snippets, required this.keys, required this.dockerHosts, required this.settings, }); Backup.fromJson(Map json) : version = json['version'] as int, date = json['date'], spis = (json['spis'] as List) .map((e) => ServerPrivateInfo.fromJson(e)) .toList(), snippets = (json['snippets'] as List).map((e) => Snippet.fromJson(e)).toList(), keys = (json['keys'] as List) .map((e) => PrivateKeyInfo.fromJson(e)) .toList(), dockerHosts = json['dockerHosts'] ?? {}, settings = json['settings'] ?? {}; Map toJson() => { 'version': version, 'date': date, 'spis': spis, 'snippets': snippets, 'keys': keys, 'dockerHosts': dockerHosts, 'settings': settings, }; }