
#                                      Copyright 2024 WebPros International, LLC
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited.

package Cpanel::Plugins::Components::whostmgr::home::360_homeapp;

use cPstrict;
use Whostmgr::360Monitoring::Config ();
use Moo;

extends 'Cpanel::Plugins::Components::Whostmgr';

has '+template_file' => (
    default => 'monitoring/spa/index.html.mini.tt',
);

has "+slot" => ( default => 'menu-top' );

has "+priority" => ( default => 5 );

has "+is_enabled" => (
    default => sub {
        my $config            = Whostmgr::360Monitoring::Config::load() || {};
        my $show_miniapp_when = $config->{'show-miniapp'};

        require Cpanel::Plugins::Components::Rules;
        my $rules_obj = Cpanel::Plugins::Components::Rules->new( config => $show_miniapp_when );
        return $rules_obj->is_allowed;
    }
);

1;
