import 'package:driverapp/config/shared_pref_kay.dart';
import 'package:driverapp/core/model/authentication/authenticated_user.dart';
import 'package:driverapp/uitl/app_shared_preferences.dart';
import 'package:location/location.dart';

class RequestUpdateDriverLocation{
  int orderID = 0;
  LocationData location;
  RequestUpdateDriverLocation({this.orderID,this.location});

  Future<Map<String, dynamic>> toJson() async{
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['OrderID'] = this.orderID;
    data['Latitude'] = "${this.location.latitude}";
    data['Longitude'] = "${this.location.longitude}";

    Map profile = await AppSharedPreferences().getObject(USER_PROFILE);
    AuthenticatedUser doctorProfile = AuthenticatedUser.fromJson(profile);
    data['DriverID'] = doctorProfile?.iD;
    data['UserID'] = '${doctorProfile?.iD}';
    return data;
  }
}