#!/usr/local/cpanel/3rdparty/bin/perl -w

#                                      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 t::Cpanel::Config::ConfigObj::Driver::ServerMonitoring::META;

use cPstrict;

use Test::More tests => 5 + 1;    # +1NoWarnings  # +1logger

use Test::Cpanel::Policy;

use Test::Deep;
use Test::MockModule qw/strict/;
use Test::NoWarnings;

use parent qw(
  Cpanel::TestObj
);

use Cpanel::Config::ConfigObj::Driver::ServerMonitoring::META ();

my $expected;
my $results;

my $mock_monitoring = Test::MockModule->new('Whostmgr::360Monitoring::Setup');

is( Cpanel::Config::ConfigObj::Driver::ServerMonitoring::META::meta_version,    1,                            "meta_version () is correct" );
is( Cpanel::Config::ConfigObj::Driver::ServerMonitoring::META::get_driver_name, "server_monitoring", "get_driver_name () is correct" );

$expected = {
    'is_recommended'       => 1,
    'is_spotlight_feature' => 0,
};
cmp_deeply( Cpanel::Config::ConfigObj::Driver::ServerMonitoring::META::showcase(), $expected, "showcase returns expected hash" ) or diag explain Cpanel::Config::ConfigObj::Driver::ServerMonitoring::META::showcase();

$expected = {
    'vendor' => 'cPanel, L.L.C.',
    'url'    => 'https://go.cpanel.net/server-monitoring',
    'name'   => {
        'short'  => 'Server Monitoring',
        'driver' => 'server_monitoring',
        'long'   => 'Server Monitoring',
    },
    'since'    => '',
    'abstract' => qq{cPanel & WHM now provides the Server Monitoring feature. You can use Server Monitoring to track your server's performance and up-time statistics.},
    'version'  => '1.0',
    'readonly' => 0,
    'defaultvalue' => 'Enable'
};

$results = Cpanel::Config::ConfigObj::Driver::ServerMonitoring::META::content();
cmp_deeply( $results->{abstract}, $expected->{abstract}, "content is correct" ) or diag explain $results;

$expected = {
    'acl'           => '360_monitoring_acl',
    'acl_subcat'    => 'Monitoring',
    'name'          => 'Server Monitoring',
    'default_value' => 1,
    'is_plugin'     => 1,
};

$results = Cpanel::Config::ConfigObj::Driver::ServerMonitoring::META::acl_desc();

cmp_deeply( $results, $expected, "acl_desc is correct" ) or diag explain $results;

1;
