class NearbySearch {
  List<Result>? results;
  String? status;

  NearbySearch({
    this.results,
    this.status,
  });

  NearbySearch.fromJson(Map<String, dynamic> json) {
    if (json['results'] != null) {
      results = [];
      json['results'].forEach((v) {
        results!.add(Result.fromJson(v));
      });
    }
    status = json['status'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    if (results != null) {
      data['result'] = results!.map((v) => v.toJson()).toList();
    }
    data['status'] = status;
    return data;
  }
}

class PlaceDetails {
  Result? result;
  String? status;

  PlaceDetails({this.result, this.status});

  PlaceDetails.fromJson(Map<String, dynamic> json) {
    result = json['result'] != null ? Result.fromJson(json['result']) : null;
    status = json['status'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};

    if (result != null) {
      data['result'] = result!.toJson();
    }
    data['status'] = status;
    return data;
  }

  static List<PlaceDetails> fromJsonDynamicList(List<dynamic> list) {
    return list.map((e) => PlaceDetails.fromJson(e)).toList();
  }
}

class Result {
  Geometry? geometry;
  String? icon;
  String? name;
  String? placeId;
  String? vicinity;
  String? adress;
  String? formattedAddress;
  String? formattedPhoneNumber;
  String? phoneNumber;
  OpeningHours? openingHours;

  Result({
    this.geometry,
    this.icon,
    this.name,
    this.placeId,
    this.vicinity,
    this.formattedPhoneNumber,
    this.phoneNumber,
    this.openingHours,
    this.adress,
    this.formattedAddress,
  });

  Result.fromJson(Map<String, dynamic> json) {
    geometry =
        json['geometry'] != null ? Geometry.fromJson(json['geometry']) : null;
    icon = json['icon'];
    name = json['name'];
    placeId = json['place_id'];
    vicinity = json['vicinity'];
    adress = json['adr_address'];
    formattedPhoneNumber = json['formatted_phone_number'] ?? "";
    phoneNumber = json['international_phone_number'] ?? "";
    formattedAddress = json['formatted_address'];
    openingHours = json['opening_hours'] != null
        ? OpeningHours.fromJson(json['opening_hours'])
        : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    if (geometry != null) {
      data['geometry'] = geometry!.toJson();
    }
    data['icon'] = icon;
    data['name'] = name;
    data['vicinity'] = vicinity;
    data['adr_address'] = adress;
    data['formatted_address'] = formattedAddress;
    data['international_phone_number'] = phoneNumber;
    data['formatted_phone_number'] = formattedPhoneNumber;
    if (openingHours != null) {
      data['opening_hours'] = openingHours!.toJson();
    }
    return data;
  }
}

class Geometry {
  Location? location;
  Geometry({
    this.location,
  });

  Geometry.fromJson(Map<String, dynamic> json) {
    location =
        json['location'] != null ? Location.fromJson(json['location']) : null;
  }
  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    if (location != null) {
      data['location'] = location!.toJson();
    }
    return data;
  }
}

class Location {
  double? lat;
  double? lng;

  Location({
    this.lat,
    this.lng,
  });

  Location.fromJson(Map<String, dynamic> json) {
    lat = json['lat'];
    lng = json['lng'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['lat'] = lat;
    data['lng'] = lng;
    return data;
  }
}

class OpeningHours {
  bool? openNow;

  OpeningHours({
    this.openNow,
  });
  OpeningHours.fromJson(Map<String, dynamic> json) {
    openNow = json['open_now'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['open_now'] = openNow;
    return data;
  }
}
