immich/mobile/lib/domain/models/local_album.model.dart
shenlong-tanwen dbe1a127c9 Merge branch 'feat/sqlite-device-assets' into feat/sqlite-remote-assets
# Conflicts:
#	mobile/drift_schemas/main/drift_schema_v1.json
#	mobile/lib/domain/models/asset/asset.model.dart
#	mobile/lib/domain/models/asset/local_asset.model.dart
#	mobile/lib/domain/models/asset/merged_asset.model.dart
#	mobile/lib/domain/models/asset/remote_asset.model.dart
#	mobile/lib/infrastructure/entities/local_asset.entity.dart
#	mobile/lib/infrastructure/entities/local_asset.entity.drift.dart
2025-04-30 23:01:23 +05:30

80 lines
1.8 KiB
Dart

import 'package:immich_mobile/utils/nullable_value.dart';
enum BackupSelection {
none,
selected,
excluded,
}
class LocalAlbum {
final String id;
final String name;
final DateTime updatedAt;
final int assetCount;
final String? thumbnailId;
final BackupSelection backupSelection;
const LocalAlbum({
required this.id,
required this.name,
required this.updatedAt,
this.assetCount = 0,
this.thumbnailId,
this.backupSelection = BackupSelection.none,
});
LocalAlbum copyWith({
String? id,
String? name,
DateTime? updatedAt,
int? assetCount,
NullableValue<String> thumbnailId = const NullableValue.absent(),
BackupSelection? backupSelection,
}) {
return LocalAlbum(
id: id ?? this.id,
name: name ?? this.name,
updatedAt: updatedAt ?? this.updatedAt,
assetCount: assetCount ?? this.assetCount,
thumbnailId: thumbnailId.getOrDefault(this.thumbnailId),
backupSelection: backupSelection ?? this.backupSelection,
);
}
@override
bool operator ==(Object other) {
if (other is! LocalAlbum) return false;
if (identical(this, other)) return true;
return other.id == id &&
other.name == name &&
other.updatedAt == updatedAt &&
other.assetCount == assetCount &&
other.thumbnailId == thumbnailId &&
other.backupSelection == backupSelection;
}
@override
int get hashCode {
return id.hashCode ^
name.hashCode ^
updatedAt.hashCode ^
assetCount.hashCode ^
thumbnailId.hashCode ^
backupSelection.hashCode;
}
@override
String toString() {
return '''LocalAlbum: {
id: $id,
name: $name,
updatedAt: $updatedAt,
assetCount: $assetCount,
thumbnailId: ${thumbnailId ?? '<NA>'},
backupSelection: $backupSelection,
}''';
}
}