/// Notiz an einer Lieferung. Text und/oder Bildanhang können gesetzt sein — /// das Backend erzwingt nicht-leer für mindestens einen der beiden. /// /// `imageAttachment` ist die UUID des hinterlegten Bildes; das eigentliche /// Binary wird über einen separaten Endpoint geladen (in einer späteren /// Phase modelliert). class DeliveryNote { const DeliveryNote({ required this.id, required this.deliveryId, required this.authorPersonalnummer, required this.createdAt, this.text, this.imageAttachment, this.authorCarId, this.creditDeliveryItemId, this.isAmountCreditNote = false, this.imageAttachmentDeleted = false, }); final String id; final String deliveryId; final String? text; final String? imageAttachment; /// Personalnummer des Fahrers (aus dem JWT zum Zeitpunkt der Erstellung). /// `int` weil im JWT als numerischer Claim transportiert. final int authorPersonalnummer; /// Fahrzeug, mit dem die Notiz erstellt wurde (Audit-Spur, optional). final String? authorCarId; /// Gesetzt, wenn die Notiz als Gutschrift-Grund zu einer Belegzeile /// angelegt wurde (deren `DeliveryItem`-Id). Erlaubt es, die Notiz beim /// Zurücknehmen der Gutschrift (Unremove) gezielt wieder zu löschen. final String? creditDeliveryItemId; /// `true`, wenn die Notiz den Grund einer Betrags-Gutschrift dokumentiert /// (Lieferungs-Ebene). Wird beim Entfernen der Gutschrift gezielt gelöscht. final bool isAmountCreditNote; /// `true`, wenn die lokale Bilddatei nach erfolgreichem Report-Upload /// gelöscht wurde — das Bild steckt dann im Lieferbericht (DOCUframe). /// Die UI zeigt statt der Vorschau einen Hinweis. final bool imageAttachmentDeleted; final DateTime createdAt; DeliveryNote copyWith({ String? id, String? deliveryId, Object? text = _sentinel, Object? imageAttachment = _sentinel, int? authorPersonalnummer, Object? authorCarId = _sentinel, Object? creditDeliveryItemId = _sentinel, bool? isAmountCreditNote, bool? imageAttachmentDeleted, DateTime? createdAt, }) { return DeliveryNote( id: id ?? this.id, deliveryId: deliveryId ?? this.deliveryId, text: identical(text, _sentinel) ? this.text : text as String?, imageAttachment: identical(imageAttachment, _sentinel) ? this.imageAttachment : imageAttachment as String?, authorPersonalnummer: authorPersonalnummer ?? this.authorPersonalnummer, authorCarId: identical(authorCarId, _sentinel) ? this.authorCarId : authorCarId as String?, creditDeliveryItemId: identical(creditDeliveryItemId, _sentinel) ? this.creditDeliveryItemId : creditDeliveryItemId as String?, isAmountCreditNote: isAmountCreditNote ?? this.isAmountCreditNote, imageAttachmentDeleted: imageAttachmentDeleted ?? this.imageAttachmentDeleted, createdAt: createdAt ?? this.createdAt, ); } } const Object _sentinel = Object();