#!/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' => '360 Monitoring plugin installs an agent on your server that allows the 360 Monitoring system to track performance and uptime statistics for your server.',
    'version'  => '1.0',
    'readonly' => 1,
};

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

$expected = {
    'acl'           => '360_monitoring_acl',
    'acl_subcat'    => 'Monitoring',
    'name'          => '360 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;
