Co-authored-by: Azareth-Tr <Azareth-Tr@users.noreply.github.com> Co-authored-by: eddgranados12 <eddgranados12@users.noreply.github.com> vistas de mockup actualizaco
39 lines
1.1 KiB
Dart
39 lines
1.1 KiB
Dart
// lib/features/feedback/feedback_model.dart
|
|
// La queja solo registra target_unit_id (número de unidad), NUNCA el chofer.
|
|
|
|
enum FeedbackType {
|
|
noPaso('no_paso', 'No pasó el camión'),
|
|
llegoTarde('llego_tarde', 'Llegó tarde'),
|
|
comportamiento('comportamiento', 'Comportamiento'),
|
|
otro('otro', 'Otro');
|
|
|
|
final String value;
|
|
final String label;
|
|
const FeedbackType(this.value, this.label);
|
|
}
|
|
|
|
class FeedbackRequest {
|
|
final String addressId;
|
|
final FeedbackType type;
|
|
final int rating; // 1-5
|
|
final String? message;
|
|
/// Solo el número de unidad — nunca el ID del chofer.
|
|
final String targetUnitId;
|
|
|
|
const FeedbackRequest({
|
|
required this.addressId,
|
|
required this.type,
|
|
required this.rating,
|
|
required this.targetUnitId,
|
|
this.message,
|
|
});
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'address_id': addressId,
|
|
'type': type.value,
|
|
'rating': rating,
|
|
'target_unit_id': targetUnitId, // ej. "101"
|
|
if (message != null && message!.isNotEmpty) 'message': message,
|
|
// ⚠️ NUNCA se manda: driver_id, driver_name, chofer_*
|
|
};
|
|
} |