# Stupid plugin for argument testing
use strict;

my $myname;

sub start_plugin {
  my ($opt,$plugin,$path) = @_;

  print STDERR "Starting plugin: $plugin\n";	# Just for demonstration sake
  $myname=$plugin;

  # Setup my hooks/options
  album::add_option(1,"onetime",album::OPTION_STR, one_time=>1, usage=>"onetime option");
  foreach my $op ( 1..3 ) {
    album::add_option(1,"bool$op",album::OPTION_BOOL, usage=>"Bool option");
    album::add_option(1,"str$op", album::OPTION_STR, default=>"DEF: $op", usage=>"String option");
    album::add_option(1,"arr$op",album::OPTION_ARR, usage=>"Array option");
  }
  album::hook($opt,'do_album_top', \&do_album_top);

  return {
    author => 'David Ljung Madison',
    href => 'http://MarginalHacks.com/',
    version => '1.0',
    description =>
"Just silliness that helps me with option testing by giving me some options",
  };
}

sub do_album_top {
  my ($opt, $data, $hookname, $dir) = @_;

  # We just wanted
  print STDERR "Options for $myname:\n";
  foreach my $op ( 1..3 ) {
    $op = "bool$op";
    my $val = album::option($opt,$op);
    print STDERR "$op: $val\n";
  }
  foreach my $op ( 1..3 ) {
    $op = "str$op";
    my $val = album::option($opt,$op);
    print STDERR "$op: $val\n";
  }
  foreach my $op ( 1..3 ) {
    $op = "arr$op";
    my $val = album::option($opt,$op);
    print STDERR "$op: @{$val}\n" if $val;
  }

#  print STDERR "\nEXIF\n----\n";
#  foreach my $exif ( @{$opt->{exif}} ) {
#    print "EX: $exif\n";
#  }
print STDERR "Die in plugin\n";
exit(0);
}

# Plugins always end with:
1;
