// Consolidated deliveries models

class DeliveryUpdate {
  int? deliveryid;
  int? orderheaderid;
  int? deliverylocationid;
  int? pickuplocationid;
  int? smsdelivery;
  String? orderstatus;
  String? starttime;
  String? arrivaltime;
  String? pickuptime;
  String? deliverytime;
  String? canceltime;
  String? riderslat;
  String? riderslon;
  String? pickuplat;
  String? pickuplong;
  String? deliverylat;
  String? deliverylong;
  String? address;
  String? city;
  String? state;
  String? suburb;
  String? postcode;
  String? kms;
  String? riderkms;
  String? actualkms;
  double? deliveryamt;
  String? notes;
  String? deliverytype;
  String? kmcal;
  String? feedback;

  DeliveryUpdate({
    this.deliveryid,
    this.orderheaderid,
    this.deliverylocationid,
    this.pickuplocationid,
    this.smsdelivery,
    this.orderstatus,
    this.starttime,
    this.arrivaltime,
    this.pickuptime,
    this.deliverytime,
    this.canceltime,
    this.riderslat,
    this.riderslon,
    this.pickuplat,
    this.pickuplong,
    this.deliverylat,
    this.deliverylong,
    this.address,
    this.city,
    this.state,
    this.suburb,
    this.postcode,
    this.kms,
    this.riderkms,
    this.actualkms,
    this.deliveryamt,
    this.notes,
    this.deliverytype,
    this.kmcal,
    this.feedback,
  });

  factory DeliveryUpdate.fromJson(Map<String, dynamic> json) {
    return DeliveryUpdate(
      deliveryid: json['deliveryid'],
      orderheaderid: json['orderheaderid'],
      deliverylocationid: json['deliverylocationid'],
      pickuplocationid: json['pickuplocationid'],
      smsdelivery: json['smsdelivery'],
      orderstatus: json['orderstatus'],
      starttime: json['starttime'],
      arrivaltime: json['arrivaltime'],
      pickuptime: json['pickuptime'],
      deliverytime: json['deliverytime'],
      canceltime: json['canceltime'],
      riderslat: json['riderslat'],
      riderslon: json['riderslon'],
      pickuplat: json['pickuplat'],
      pickuplong: json['pickuplong'],
      deliverylat: json['deliverylat'],
      deliverylong: json['deliverylong'],
      address: json['address'],
      city: json['city'],
      state: json['state'],
      suburb: json['suburb'],
      postcode: json['postcode'],
      kms: json['kms'],
      riderkms: json['riderkms'],
      actualkms: json['actualkms'],
      deliveryamt: (json['deliveryamt'] as num?)?.toDouble(),
      notes: json['notes'],
      deliverytype: json['deliverytype'],
      kmcal: json['kmcal'],
      feedback: json['feedback'],
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['deliveryid'] = deliveryid;
    data['orderheaderid'] = orderheaderid;
    data['deliverylocationid'] = deliverylocationid;
    data['pickuplocationid'] = pickuplocationid;
    data['smsdelivery'] = smsdelivery;
    data['orderstatus'] = orderstatus;
    data['starttime'] = starttime;
    data['arrivaltime'] = arrivaltime;
    data['pickuptime'] = pickuptime;
    data['deliverytime'] = deliverytime;
    data['canceltime'] = canceltime;
    data['riderslat'] = riderslat;
    data['riderslon'] = riderslon;
    data['pickuplat'] = pickuplat;
    data['pickuplong'] = pickuplong;
    data['deliverylat'] = deliverylat;
    data['deliverylong'] = deliverylong;
    data['address'] = address;
    data['city'] = city;
    data['state'] = state;
    data['suburb'] = suburb;
    data['postcode'] = postcode;
    data['kms'] = kms;
    data['riderkms'] = riderkms;
    data['actualkms'] = actualkms;
    data['deliveryamt'] = deliveryamt;
    data['notes'] = notes;
    data['deliverytype'] = deliverytype;
    data['kmcal'] = kmcal;
    data['feedback'] = feedback;
    return data;
  }
}

class DeliveryLogModel {
  int? logid;
  int? tenantid;
  int? partnerid;
  int? locationid;
  int? orderheaderid;
  int? deliveryid;
  int? userid;
  String? orderid;
  String? logdate;
  String? orderstatus;
  String? latitude;
  String? longitude;

  DeliveryLogModel({
    this.logid,
    this.tenantid,
    this.partnerid,
    this.locationid,
    this.orderheaderid,
    this.deliveryid,
    this.userid,
    this.orderid,
    this.logdate,
    this.orderstatus,
    this.latitude,
    this.longitude,
  });

  factory DeliveryLogModel.fromJson(Map<String, dynamic> json) {
    return DeliveryLogModel(
      logid: json['logid'],
      tenantid: json['tenantid'],
      partnerid: json['Partnerid'] ?? json['partnerid'],
      locationid: json['Locationid'] ?? json['locationid'],
      orderheaderid: json['orderheaderid'],
      deliveryid: json['deliveryid'],
      userid: json['userid'],
      orderid: json['orderid'],
      logdate: json['logdate'],
      orderstatus: json['orderstatus'],
      latitude: json['latitude'],
      longitude: json['longitude'],
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['logid'] = logid;
    data['tenantid'] = tenantid;
    data['Partnerid'] = partnerid;
    data['Locationid'] = locationid;
    data['orderheaderid'] = orderheaderid;
    data['deliveryid'] = deliveryid;
    data['userid'] = userid;
    data['orderid'] = orderid;
    data['logdate'] = logdate;
    data['orderstatus'] = orderstatus;
    data['latitude'] = latitude;
    data['longitude'] = longitude;
    return data;
  }
}

class DeliverySummaryModel {
  int? total;
  int? created;
  int? pending;
  int? accepted;
  int? picked;
  int? delivered;
  int? cancelled;

  DeliverySummaryModel({
    this.total,
    this.created,
    this.pending,
    this.accepted,
    this.picked,
    this.delivered,
    this.cancelled,
  });

  factory DeliverySummaryModel.fromJson(Map<String, dynamic> json) {
    return DeliverySummaryModel(
      total: json['total'],
      created: json['created'],
      pending: json['pending'],
      accepted: json['accepted'],
      picked: json['picked'],
      delivered: json['delivered'],
      cancelled: json['cancelled'],
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['total'] = total;
    data['created'] = created;
    data['pending'] = pending;
    data['accepted'] = accepted;
    data['picked'] = picked;
    data['delivered'] = delivered;
    data['cancelled'] = cancelled;
    return data;
  }
}

class DeliveryItem {
  int? logid;
  String? logdate;
  int? tenantid;
  int? locationid;
  int? orderheaderid;
  int? deliveryid;
  int? userid;
  int? partnerid;
  String? orderid;
  String? orderstatus;
  String? latitude;
  String? longitude;
  int? logstatus;

  DeliveryItem({
    this.logid,
    this.logdate,
    this.tenantid,
    this.locationid,
    this.orderheaderid,
    this.deliveryid,
    this.userid,
    this.partnerid,
    this.orderid,
    this.orderstatus,
    this.latitude,
    this.longitude,
    this.logstatus,
  });

  factory DeliveryItem.fromJson(Map<String, dynamic> json) {
    return DeliveryItem(
      logid: json['logid'],
      logdate: json['logdate'],
      tenantid: json['tenantid'],
      locationid: json['locationid'],
      orderheaderid: json['orderheaderid'],
      deliveryid: json['deliveryid'],
      userid: json['userid'],
      partnerid: json['partnerid'],
      orderid: json['orderid'],
      orderstatus: json['orderstatus'],
      latitude: json['latitude'],
      longitude: json['longitude'],
      logstatus: json['logstatus'],
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['logid'] = logid;
    data['logdate'] = logdate;
    data['tenantid'] = tenantid;
    data['locationid'] = locationid;
    data['orderheaderid'] = orderheaderid;
    data['deliveryid'] = deliveryid;
    data['userid'] = userid;
    data['partnerid'] = partnerid;
    data['orderid'] = orderid;
    data['orderstatus'] = orderstatus;
    data['latitude'] = latitude;
    data['longitude'] = longitude;
    data['logstatus'] = logstatus;
    return data;
  }
}


