use strict;
use warnings;

our @Initial = (
    # add default reports
    sub {
        my $reports_in_menu = 'ReportsInMenu';
        my $attr = RT::Attribute->new( RT->SystemUser );
        my( $ok, $msg) = $attr->LoadByNameAndObject( Object => RT->System, Name => $reports_in_menu );
        # add attribute only if it does not already exist
        if ( !$ok ) {
            RT->Logger->debug( "Adding default reports in menu" );
            my $content = [
                {
                    id          => 'resolvedbyowner',
                    title       => 'Resolved by owner', # loc
                    path        => '/Reports/ResolvedByOwner.html',
                },
                {
                    id          => 'resolvedindaterange',
                    title       => 'Resolved in date range', # loc
                    path        => '/Reports/ResolvedByDates.html',
                },
                {
                    id          => 'createdindaterange',
                    title       => 'Created in a date range', # loc
                    path        => '/Reports/CreatedByDates.html',
                },
            ];

            RT->System->AddAttribute(
                        Name => $reports_in_menu,
                        Description => 'Content of the Reports menu',
                        Content => $content,
            );
        }
    }
);
