// image_metadata_model.dart import 'package:problem_check_system/data/models/image_status.dart'; class ImageMetadata { final String localPath; final String? remoteUrl; final ImageStatus status; ImageMetadata({ required this.localPath, this.remoteUrl, required this.status, }); // For saving to SQL Map toMap() { return { 'localPath': localPath, 'remoteUrl': remoteUrl, 'status': status.index, }; } // For reading from SQL factory ImageMetadata.fromMap(Map map) { return ImageMetadata( localPath: map['localPath'] as String, remoteUrl: map['remoteUrl'] as String?, status: ImageStatus.values[map['status'] as int], ); } /// Creates a new [ImageMetadata] instance with optional new values. /// /// The original object remains unchanged. ImageMetadata copyWith({ String? localPath, String? remoteUrl, ImageStatus? status, }) { return ImageMetadata( localPath: localPath ?? this.localPath, remoteUrl: remoteUrl ?? this.remoteUrl, status: status ?? this.status, ); } }