import 'package:equatable/equatable.dart'; class Vehicle extends Equatable { const Vehicle({ required this.id, this.make, this.model, this.year, this.color, this.plate, this.isDefault = false, this.status = 'pending', }); final String id; final String? make; final String? model; final int? year; final String? color; final String? plate; /// أول مركبة تصير الافتراضية تلقائياً على الخادم (docs/38 §5). final bool isDefault; final String status; factory Vehicle.fromJson(Map json) => Vehicle( id: json['id'] as String? ?? '', make: json['make'] as String?, model: json['model'] as String?, year: (json['year'] as num?)?.toInt(), color: json['color'] as String?, plate: json['plate'] as String?, isDefault: json['is_default'] as bool? ?? false, status: json['status'] as String? ?? 'pending', ); String get label => [make, model, year?.toString()] .whereType() .where((s) => s.isNotEmpty) .join(' '); @override List get props => [id, plate, isDefault, status]; }