package App::SCS::Role::PageChildren;

use Moo::Role;

requires '_page_set';
requires '_page_set_class';
requires '_top_dir';
requires '_my_path';

sub children {
  my ($self, %args) = @_;
  if (my $at = delete $args{at_depth}) {
    @args{qw(min_depth max_depth)} = ($at, $at);
  }
  $self->_page_set_class->new(
    top_dir => $self->_top_dir,
    base_dir => $self->_my_path,
    max_depth => 1,
    plugin_config => $self->_page_set->plugin_config,
    %args,
  );
}

1;
