Files
immich/mobile/lib/domain/models/asset/asset_metadata.model.dart
T
2025-09-06 01:56:22 +05:30

40 lines
810 B
Dart

import 'dart:convert';
enum RemoteAssetMetadataKey {
mobileApp("mobile-app");
final String key;
const RemoteAssetMetadataKey(this.key);
factory RemoteAssetMetadataKey.fromKey(String key) {
switch (key) {
case "mobile-app":
return RemoteAssetMetadataKey.mobileApp;
default:
throw ArgumentError("Unknown AssetMetadataKey key: $key");
}
}
}
class RemoteAssetMetadata {
final String? cloudId;
const RemoteAssetMetadata({this.cloudId});
Map<String, dynamic> toMap() {
final mobileAppValue = {};
if (cloudId != null) {
mobileAppValue["iCloudId"] = cloudId;
}
return {
"metadata": [
{"key": RemoteAssetMetadataKey.mobileApp.key, "value": mobileAppValue},
],
};
}
String toJson() => json.encode(toMap());
}