fully type Resolution* classes
[scpubgit/DX.git] / lib / DX / Resolution.pm
index 1d5d335..a821f7a 100644 (file)
@@ -1,9 +1,32 @@
 package DX::Resolution;
 
+use DX::Utils qw(expand_deps);
 use DX::Class;
 
-has veracity_depends_on => (is => 'ro', required => 1);
+has veracity_depends_on => (is => 'ro', required => 1, isa => DependencyList);
 
-has actions => (is => 'ro', required => 1);
+has actions => (is => 'ro', required => 1, isa => ArrayRef[Action]);
+
+sub next_resolution { $_[0] }
+
+sub remainder { () }
+
+sub for_deparse {
+  my ($self) = @_;
+  [ word_and_body => [
+    'resolution',
+    [ pairs => [
+      (@{$self->actions}
+        ? [ actions => [ block => $self->actions ] ]
+        : ()),
+      [ veracity_depends_on => [ block => [
+        map [ statement => [
+          [ symbol => (split '::', ${$_->[0]})[-1] ],
+          [ value_path => [ @{$_}[1..$#$_] ] ],
+        ] ], @{expand_deps($self->veracity_depends_on)}
+      ] ] ],
+    ] ],
+  ] ];
+}
 
 1;