Files
hackathon-innovaflow5.0-cdf…/views_v2/feedback_model.dart
2026-05-22 23:50:10 -06:00

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_*
};
}