<?php
/**
 * File Path: templates/partials/series-complete-badge.php
 *
 * My Book Showroom -- Series Complete Badge
 *
 * Renders a "Complete Series" pill badge when mbs_series_complete term
 * meta is '1'. GP-UI-1: outputs nothing when the flag is absent or false.
 *
 * Usage:
 *   mbs_get_template_part( 'partials/series-complete-badge', array(
 *       'series_term_id' => $term_id,
 *   ) );
 *
 * @package MyBookShowroom
 * @since   1.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

$mbs_sc_term_id = isset( $args['series_term_id'] ) ? (int) $args['series_term_id'] : 0; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- template-scope variable; not a global
if ( ! $mbs_sc_term_id ) {
	return; // GP-UI-1: no term context -- no output.
}

$mbs_sc_complete = (string) get_term_meta( $mbs_sc_term_id, 'mbs_series_complete', true ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- template-scope variable; not a global
if ( '1' !== $mbs_sc_complete ) {
	return; // GP-UI-1: not marked complete -- no output.
}
?>
<p class="mbs-series-complete-wrap">
	<span class="mbs-series-complete-badge">
		<?php esc_html_e( 'Complete Series', 'my-book-showroom' ); ?>
	</span>
</p>
