import 'wayz_common_models.dart';

class WzDistanceResponse {
  /// status: 1 success (document)
  final int status;
  final String info;
  final List<double> results;

  WzDistanceResponse({
    required this.status,
    required this.info,
    required this.results,
  });

  factory WzDistanceResponse.fromJson(Map<String, dynamic> json) {
    return WzDistanceResponse(
      status: WzJson.toInt(json['status']) ?? 0,
      info: WzJson.toStringOrNull(json['info']) ?? '',
      results: (json['results'] as List? ?? [])
          .map((e) => WzJson.toDouble(e) ?? 0)
          .toList(),
    );
  }

  Map<String, dynamic> toJson() => {
        'status': status,
        'info': info,
        'results': results,
      };
}

