mirror of
https://github.com/immich-app/immich.git
synced 2024-12-21 01:39:59 +02:00
b05132a01a
* refactor: server info model to use data classes instead of dtos * mobile: add return types and refactor private variables in map / stack --------- Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
60 lines
1.6 KiB
Dart
60 lines
1.6 KiB
Dart
import 'package:openapi/api.dart';
|
|
|
|
class ServerDiskInfo {
|
|
final String diskAvailable;
|
|
final String diskSize;
|
|
final String diskUse;
|
|
final double diskUsagePercentage;
|
|
|
|
const ServerDiskInfo({
|
|
required this.diskAvailable,
|
|
required this.diskSize,
|
|
required this.diskUse,
|
|
required this.diskUsagePercentage,
|
|
});
|
|
|
|
ServerDiskInfo copyWith({
|
|
String? diskAvailable,
|
|
String? diskSize,
|
|
String? diskUse,
|
|
double? diskUsagePercentage,
|
|
}) {
|
|
return ServerDiskInfo(
|
|
diskAvailable: diskAvailable ?? this.diskAvailable,
|
|
diskSize: diskSize ?? this.diskSize,
|
|
diskUse: diskUse ?? this.diskUse,
|
|
diskUsagePercentage: diskUsagePercentage ?? this.diskUsagePercentage,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return 'ServerDiskInfo(diskAvailable: $diskAvailable, diskSize: $diskSize, diskUse: $diskUse, diskUsagePercentage: $diskUsagePercentage)';
|
|
}
|
|
|
|
ServerDiskInfo.fromDto(ServerInfoResponseDto dto)
|
|
: diskAvailable = dto.diskAvailable,
|
|
diskSize = dto.diskSize,
|
|
diskUse = dto.diskUse,
|
|
diskUsagePercentage = dto.diskUsagePercentage;
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
if (identical(this, other)) return true;
|
|
|
|
return other is ServerDiskInfo &&
|
|
other.diskAvailable == diskAvailable &&
|
|
other.diskSize == diskSize &&
|
|
other.diskUse == diskUse &&
|
|
other.diskUsagePercentage == diskUsagePercentage;
|
|
}
|
|
|
|
@override
|
|
int get hashCode {
|
|
return diskAvailable.hashCode ^
|
|
diskSize.hashCode ^
|
|
diskUse.hashCode ^
|
|
diskUsagePercentage.hashCode;
|
|
}
|
|
}
|