package DX::Role::Value;

use DX::ActionBuilder::Null;
use DX::Role;

my $_null = DX::ActionBuilder::Null->new;

has action_builder => (
  is => 'ro',
  isa => ActionBuilder,
  default => sub { $_null },
  handles => [ qw(can_set_value aperture_for_set_value action_for_set_value) ],
);

sub value_path { shift->action_builder->target_path }

sub is_set { 1 }

sub but_set_action_builder {
  my ($self, $ab) = @_;
  $self->but(action_builder => $ab);
}

requires 'to_data';

sub equals {
  my ($self, $other) = @_;
  require YAML;
  YAML::Dump($self->to_data) eq YAML::Dump($other->to_data);
}

1;
