package DX::ActionBuilder::ProxySetToAdd;

use DX::Utils qw(VALUE_SET);
use DX::Class;

with 'DX::Role::ActionBuilder';

has target_path => (is => 'ro', required => 1, isa => ValuePath);

has proxy_to => (is => 'ro', required => 1, isa => ActionBuilder);

sub aperture_for_set_value {
  my ($self) = @_;
  [
    [ VALUE_SET ,=> @{$self->target_path} ],
    @{$self->proxy_to->aperture_for_add_member($self->target_path->[-1])}
  ]
}

sub action_for_set_value {
  my ($self, $value) = @_;
  $self->proxy_to->action_for_add_member($self->target_path->[-1], $value);
}

1;
