2023-10-22 22:15:34 +02:00
|
|
|
import 'package:immich_mobile/shared/models/server_info/server_config.model.dart';
|
|
|
|
import 'package:immich_mobile/shared/models/server_info/server_disk_info.model.dart';
|
|
|
|
import 'package:immich_mobile/shared/models/server_info/server_features.model.dart';
|
|
|
|
import 'package:immich_mobile/shared/models/server_info/server_version.model.dart';
|
2022-03-22 08:22:04 +02:00
|
|
|
|
2023-10-22 22:15:34 +02:00
|
|
|
class ServerInfo {
|
|
|
|
final ServerVersion serverVersion;
|
|
|
|
final ServerFeatures serverFeatures;
|
|
|
|
final ServerConfig serverConfig;
|
|
|
|
final ServerDiskInfo serverDiskInfo;
|
2022-03-22 08:22:04 +02:00
|
|
|
final bool isVersionMismatch;
|
|
|
|
final String versionMismatchErrorMessage;
|
|
|
|
|
2023-10-22 22:15:34 +02:00
|
|
|
ServerInfo({
|
2022-03-22 08:22:04 +02:00
|
|
|
required this.serverVersion,
|
2023-09-28 05:26:48 +02:00
|
|
|
required this.serverFeatures,
|
|
|
|
required this.serverConfig,
|
2022-03-22 08:22:04 +02:00
|
|
|
required this.isVersionMismatch,
|
2023-10-22 22:15:34 +02:00
|
|
|
required this.serverDiskInfo,
|
2022-03-22 08:22:04 +02:00
|
|
|
required this.versionMismatchErrorMessage,
|
|
|
|
});
|
|
|
|
|
2023-10-22 22:15:34 +02:00
|
|
|
ServerInfo copyWith({
|
|
|
|
ServerVersion? serverVersion,
|
|
|
|
ServerFeatures? serverFeatures,
|
|
|
|
ServerConfig? serverConfig,
|
|
|
|
ServerDiskInfo? serverDiskInfo,
|
2022-03-22 08:22:04 +02:00
|
|
|
bool? isVersionMismatch,
|
|
|
|
String? versionMismatchErrorMessage,
|
|
|
|
}) {
|
2023-10-22 22:15:34 +02:00
|
|
|
return ServerInfo(
|
2022-03-22 08:22:04 +02:00
|
|
|
serverVersion: serverVersion ?? this.serverVersion,
|
2023-09-28 05:26:48 +02:00
|
|
|
serverFeatures: serverFeatures ?? this.serverFeatures,
|
|
|
|
serverConfig: serverConfig ?? this.serverConfig,
|
2022-03-22 08:22:04 +02:00
|
|
|
isVersionMismatch: isVersionMismatch ?? this.isVersionMismatch,
|
2022-06-25 22:12:47 +02:00
|
|
|
versionMismatchErrorMessage:
|
|
|
|
versionMismatchErrorMessage ?? this.versionMismatchErrorMessage,
|
2023-10-22 22:15:34 +02:00
|
|
|
serverDiskInfo: serverDiskInfo ?? this.serverDiskInfo,
|
2022-03-22 08:22:04 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() {
|
2023-10-22 22:15:34 +02:00
|
|
|
return 'ServerInfo(serverVersion: $serverVersion, serverFeatures: $serverFeatures, serverConfig: $serverConfig, isVersionMismatch: $isVersionMismatch, versionMismatchErrorMessage: $versionMismatchErrorMessage, serverDiskInfo: $serverDiskInfo)';
|
2022-03-22 08:22:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool operator ==(Object other) {
|
|
|
|
if (identical(this, other)) return true;
|
|
|
|
|
2023-10-22 22:15:34 +02:00
|
|
|
return other is ServerInfo &&
|
2022-03-22 08:22:04 +02:00
|
|
|
other.serverVersion == serverVersion &&
|
2023-09-28 05:26:48 +02:00
|
|
|
other.serverFeatures == serverFeatures &&
|
|
|
|
other.serverConfig == serverConfig &&
|
2023-10-22 22:15:34 +02:00
|
|
|
other.serverDiskInfo == serverDiskInfo &&
|
2022-03-22 08:22:04 +02:00
|
|
|
other.isVersionMismatch == isVersionMismatch &&
|
|
|
|
other.versionMismatchErrorMessage == versionMismatchErrorMessage;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
int get hashCode {
|
2022-07-13 14:23:48 +02:00
|
|
|
return serverVersion.hashCode ^
|
2023-09-28 05:26:48 +02:00
|
|
|
serverFeatures.hashCode ^
|
|
|
|
serverConfig.hashCode ^
|
2022-03-22 08:22:04 +02:00
|
|
|
isVersionMismatch.hashCode ^
|
2023-10-22 22:15:34 +02:00
|
|
|
versionMismatchErrorMessage.hashCode ^
|
|
|
|
serverDiskInfo.hashCode;
|
2022-03-22 08:22:04 +02:00
|
|
|
}
|
|
|
|
}
|