# GooglePrimaryEmail subtype GooglePrimaryEmail, as EmailAddress, where { $_ }, message { 'validation failed for: '. Dumper $_; }; coerce GooglePrimaryEmail, from ArrayRef[HashRef[Str]], via { my @primary = map { if ($_->{primary} == 1) { $_->{value} } } @$_; return $primary[0]; };