aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ComponentUI/TestModel/Foo/SearchSpec.pm
blob: 4664ec645bef8a93dcf6157cf5381a2c42bceba9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package ComponentUI::TestModel::Foo::SearchSpec;
use Reaction::Class;
use namespace::autoclean;

use MooseX::Types::Common::String qw/NonEmptySimpleStr/;

with 'Reaction::InterfaceModel::Search::Spec';

has 'first_name' => (isa => NonEmptySimpleStr, is => 'rw', required => 0);
has 'last_name' => (isa => NonEmptySimpleStr, is => 'rw', required => 0);

sub _build__search_spec {
  my($self) = @_;
  my %search;
  $search{first_name} = $self->first_name if $self->has_first_name;
  $search{last_name} = $self->last_name if $self->has_last_name;
  return [\%search];
}

# no special packing/unpacking required for Foo
sub _to_string_pack_value { $_[1] }
sub _from_string_unpack_value { $_[1] }

1;