30 lines
1.2 KiB
Dart
30 lines
1.2 KiB
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
import 'backup_config.dart';
|
|
|
|
part 'service.freezed.dart';
|
|
part 'service.g.dart';
|
|
|
|
/// Mirrors `models.Service` — a compose-based service on this host.
|
|
/// `status` is one of "up" / "down" / "unknown" (untyped string on the Go
|
|
/// side); kept as a raw string here too and mapped to [Severity] at the
|
|
/// widget boundary rather than modeled as a closed enum, since the server
|
|
/// can emit values this client doesn't yet know about.
|
|
@freezed
|
|
sealed class Service with _$Service {
|
|
const factory Service({
|
|
@Default('') String id,
|
|
required String name,
|
|
@JsonKey(name: 'compose_file') required String composeFile,
|
|
@JsonKey(name: 'compose_type') String? composeType,
|
|
@JsonKey(name: 'backup_folder') String? backupFolder,
|
|
@Default('unknown') String status,
|
|
@JsonKey(name: 'stop_on_backup') @Default(false) bool stopOnBackup,
|
|
@JsonKey(name: 'external_backup_stop_minutes') @Default(0) int externalBackupStopMinutes,
|
|
@JsonKey(name: 'external_backup_start_minutes') @Default(0) int externalBackupStartMinutes,
|
|
BackupConfig? backup,
|
|
}) = _Service;
|
|
|
|
factory Service.fromJson(Map<String, dynamic> json) => _$ServiceFromJson(json);
|
|
}
|