import 'package:json_annotation/json_annotation.dart';
part 'full_address_model.g.dart';
@JsonSerializable(fieldRename: FieldRename.snake)
class FullAddress {
  String? streetNumber;
  String? zipCode;
  double? latitude;
  double? longitude;
  String? formattedAddress;
  String? street;
  String? region;
  String? city;
  String? country;

  FullAddress({
    this.streetNumber,
    this.zipCode,
    this.latitude,
    this.longitude,
    this.formattedAddress,
    this.street,
    this.region,
    this.city,
    this.country,
  });

  factory FullAddress.fromJson(Map<String, dynamic> json) {
    return _$FullAddressFromJson(json);
  }

  Map<String, dynamic> toJson() => _$FullAddressToJson(this);

  static FullAddress fromGoogle(Map<String, dynamic> fullAddress) {
    return FullAddress(
      streetNumber: fullAddress['street_number'],
      zipCode: fullAddress['postal_code'],
      latitude: fullAddress['lat'],
      longitude: fullAddress['lng'],
      formattedAddress: fullAddress['formatted_address'],
      street: fullAddress['street'],
      region: fullAddress['state'],
      city: fullAddress['city'],
      country: fullAddress['country'],
    );
  }
}
