use strict;
use warnings;

require RT::Asset;

our @Catalogs;

@Catalogs = ({
    Name        => "General assets",      # loc
    Description => "The default catalog", # loc
});

our @Final;

# Create global role groups
push @Final, sub {
    foreach my $type (RT::Asset->Roles) {
        next if $type eq "Owner";   # There's a core global role group for Owner

        my $group = RT->System->RoleGroup( $type );
        if ( $group->id ) {
            RT->Logger->debug("Assets role '$type' already exists.");
            next;
        }

        $group = RT::Group->new( RT->SystemUser );
        my ($ok, $msg) = $group->CreateRoleGroup(
            Object              => RT->System,
            Name                => $type,
            InsideTransaction   => 0,
        );
        RT->Logger->error("Couldn't create global asset role group '$type': $msg")
            unless $ok;
    }
};

