<?php
/**
 * Active module summary card partial.
 *
 * @package MonitorCat
 *
 * @var \MonitorCat\Module\ModuleInterface $module Module instance.
 */

defined( 'ABSPATH' ) || exit;

$monitorcat_card_slug = $module->slug();
$monitorcat_card_link = admin_url( 'admin.php?page=monitor-cat-' . $monitorcat_card_slug );
$monitorcat_summary   = method_exists( $module, 'dashboard_summary' ) ? $module->dashboard_summary() : array();
$monitorcat_score     = isset( $monitorcat_summary['score'] ) ? (int) $monitorcat_summary['score'] : null;
?>

<div class="mc-card mc-card-hover mc-module-card" data-module="<?php echo esc_attr( $monitorcat_card_slug ); ?>">
	<div class="mc-card-body">
		<div class="mc-module-card-header">
			<div class="mc-icon-pedestal">
				<span class="dashicons <?php echo esc_attr( $module->icon() ); ?>"></span>
			</div>
			<?php if ( null !== $monitorcat_score ) : ?>
				<?php
				$score = $monitorcat_score; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- expected by score-ring partial.
				include MONITORCAT_DIR . 'templates/admin/partials/score-ring.php';
				?>
			<?php endif; ?>
		</div>
		<h3 class="mc-module-card-title"><?php echo esc_html( $module->name() ); ?></h3>
		<p class="mc-text-medium"><?php echo esc_html( $module->description() ); ?></p>
	</div>
	<div class="mc-card-footer">
		<a href="<?php echo esc_url( $monitorcat_card_link ); ?>" class="mc-btn mc-btn-primary mc-btn-sm">
			<?php esc_html_e( 'Open', 'monitor-cat' ); ?>
		</a>
	</div>
</div>
