package DX::ActionBuilder::Normal;

use DX::Action::SetValue;
use DX::Action::AddValue;
use DX::Class;

with 'DX::Role::ActionBuilder';

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

sub action_for_set_value {
  my ($self, $value) = @_;
  DX::Action::SetValue->new(
    target_path => $self->target_path,
    new_value => $value->but_set_action_builder($self)
  );
}

sub action_for_add_member {
  my ($self, $at, $value) = @_;
  my @add_path = (@{$self->target_path}, ref($at) ? $at->string_value : $at);
  DX::Action::AddValue->new(
    target_path => \@add_path,
    new_value => $value->but_set_action_builder(
                   $self->but(target_path => \@add_path)
                 )
  );
}

sub action_for_remove_member { die 'WHUT' }

1;
