class RiderWeeklyKms {
  final String day;
  final double kms;

  RiderWeeklyKms({
    required this.day,
    required this.kms,
  });

  factory RiderWeeklyKms.fromJson(Map<String, dynamic> json) {
    return RiderWeeklyKms(
      day: json['day'] ?? '',
      kms: double.tryParse('${json['kms'] ?? 0}') ?? 0.0,
    );
  }
}

class RiderWeeklyKmsResponse {
  final bool status;
  final int code;
  final String message;
  final double totalKms;
  final double overallKms;
  final List<RiderWeeklyKms> details;

  RiderWeeklyKmsResponse({
    required this.status,
    required this.code,
    required this.message,
    required this.totalKms,
    required this.overallKms,
    required this.details,
  });

  factory RiderWeeklyKmsResponse.fromJson(Map<String, dynamic> json) {
    return RiderWeeklyKmsResponse(
      status: json['status'] ?? false,
      code: json['code'] ?? 0,
      message: json['message'] ?? '',
      totalKms: double.tryParse('${json['total_kms'] ?? 0}') ?? 0.0,
      overallKms: double.tryParse('${json['overall_kms'] ?? 0}') ?? 0.0,
      details: (json['details'] as List<dynamic>? ?? [])
          .map((e) => RiderWeeklyKms.fromJson(e))
          .toList(),
    );
  }
}


