package DX::Role::SimpleAction;

use DX::Role;

with 'DX::Role::Action';

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

has _updates => (is => 'lazy');

requires '_build__updates';

sub dry_run {
  my ($self, $hyp) = @_;
  my ($scope, @events) = $hyp->scope->apply_updates($self->_updates);
  return (
    $hyp->but(
      scope => $scope,
      actions => [ @{$hyp->actions}, $self ],
      action_applications => [ @{$hyp->action_applications}, $self ],
    ),
    @events
  );
}

sub run { shift->updates }

1;
