package DX::Role::Value;

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

has identity_path => (is => 'ro');

has action_builder => (
  is => 'ro',
  default => 'DX::ActionBuilder::Null',
  handles => [ qw(can_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);
}

sub but_set_identity_path {
  my ($self, $path) = @_;
  $self->but(identity_path => $path);
}

requires 'to_data';

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

1;
