package DBIx::Data::Store::Inflator::Simple;

use strictures 1;

sub new {
  my $proto = shift;
  bless({ %{$_[0]} }, ref($proto)||$proto);
}

sub _class { shift->{class} }
sub _spec_columns { shift->{spec_columns} }
sub _body_columns { shift->{body_columns} }
sub _all_columns { shift->{all_columns} }

sub inflate {
  my ($self, $raw) = @_;
  my %new; @new{@{$self->_all_columns}} = @$raw;
  bless(\%new, $self->_class);
}

sub deflate_spec {
  my ($self, $spec) = @_;
  [ @{$spec}{@{$self->_spec_columns}} ];
}

sub deflate_body {
  my ($self, $spec) = @_;
  [ @{$spec}{@{$self->_body_columns}} ];
}

1;
