import 'package:freezed_annotation/freezed_annotation.dart'; import 'backup_config.dart'; import 'update_record.dart'; part 'node_info.freezed.dart'; part 'node_info.g.dart'; /// Mirrors `models.NodeInfo` — the local/current host's identity + backup /// config + update log, as served by `GET /node/`. /// /// `resticPassword` is write-only: the API never echoes the real password /// back (`GET /node/` sends `restic_password_set` instead, see /// `controllers/node.go`), so this stays `null` unless the user is actively /// setting/changing it in the identity form, and is omitted from the PUT /// body entirely when `null` so an untouched form never clobbers the /// existing password (mirrors the Go side's "empty string = don't change"). @freezed sealed class NodeInfo with _$NodeInfo { const factory NodeInfo({ required String hostname, String? description, @JsonKey(name: 'update_history') @Default([]) List updateHistory, required BackupConfig backup, @JsonKey(name: 'restic_password_set') @Default(false) bool resticPasswordSet, @JsonKey(name: 'restic_password', includeIfNull: false) String? resticPassword, }) = _NodeInfo; factory NodeInfo.fromJson(Map json) => _$NodeInfoFromJson(json); }