package Geo::USCensus::Geocoding::Match;

use strict;

sub new {
  my $class = shift;
  my $address = shift;
  my $census = shift;

  my $self = { %$address };
  bless $self, $class;
}

sub matchedAddress {
  my $self = shift;
  $self->{matchedAddress};
}

sub coordinates {
  my $self = shift;
  $self->{coordinates};
}

sub addressComponents {
  my $self = shift;
  $self->{addressComponents};
}

sub geographies {
  my $self = shift;
  $self->{geographies};
}

sub censustract {
  my $self = shift;
  return '' unless $self->geographies
                and exists($self->geographies->{'Census Tracts'})
                and exists($self->geographies->{'Census Tracts'}->[0]);
  my $ct = $self->geographies->{'Census Tracts'}->[0];
  return $ct->{STATE} . $ct->{COUNTY} . $ct->{TRACT};
}

1;
