import 'scooter.dart';

class ActiveScooterOrder {
  final int orderId;
  final int scooterId;
  final double latitude;
  final double longitude;
  final double mileage;
  final double speed;
  final double price;
  final double time;
  final bool zone;

  ActiveScooterOrder({
    required this.orderId,
    required this.scooterId,
    required this.latitude,
    required this.longitude,
    required this.mileage,
    required this.speed,
    required this.price,
    required this.time,
    required this.zone,
  });

  factory ActiveScooterOrder.fromJson(Map<String, dynamic> json) {
    return ActiveScooterOrder(
      orderId: json['orderId'] ?? 0,
      scooterId: json['scooterId'] ?? 0,
      latitude: (json['latitude'] ?? 0).toDouble(),
      longitude: (json['longitude'] ?? 0).toDouble(),
      mileage: (json['mileage'] ?? 0).toDouble(),
      speed: (json['speed'] ?? 0).toDouble(),
      price: (json['price'] ?? 0).toDouble(),
      time: (json['time'] ?? 0.0).toDouble(),
      zone: json['zone'],
    );
  }
  Map<String, dynamic> toJson() {
    return {
      'orderId': orderId,
      'scooterId': scooterId,
      'latitude': latitude,
      'longitude': longitude,
      'mileage': mileage,
      'speed': speed,
      'price': price,
    };
  }
}
