<?php
/**
 * Global admin header for PrimeLink pages.
 *
 * Expects the following variables (all optional) to be defined before include:
 * - $header_eyebrow       string  Short label above the title.
 * - $header_title         string  Main page title.
 * - $header_description   string  Short description under the title.
 * - $header_status_label  string  Status pill label (e.g. "Running").
 * - $header_status_class  string  Status modifier class (e.g. "mt_primelink-status-running").
 * - $header_release_url   string  URL for release / help link.
 * - $header_release_label string  Label for release / help link.
 * - $header_actions       string  HTML for action buttons (right column, under version).
 *
 * @package PrimeLink
 */

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

$header_eyebrow       = isset( $header_eyebrow ) ? $header_eyebrow : '';
$header_title         = isset( $header_title ) ? $header_title : '';
$header_description   = isset( $header_description ) ? $header_description : '';
$header_status_label  = isset( $header_status_label ) ? $header_status_label : '';
$header_status_class  = isset( $header_status_class ) ? $header_status_class : '';
$header_release_url   = isset( $header_release_url ) ? $header_release_url : '';
$header_release_label = isset( $header_release_label ) ? $header_release_label : '';
$header_actions       = isset( $header_actions ) ? $header_actions : '';
?>

<div class="mt_primelink-dashboard__header glass">
    <div class="mt_primelink-dashboard__left">
        <div class="mt_primelink-brand-head">
            <img src="<?php echo esc_url( MT_PRIMELINK_URL . 'assets/admin/img/logo.png' ); ?>" alt="<?php esc_attr_e( 'PrimeLink', 'primelink' ); ?>" class="mt_primelink-brand-logo mt_primelink-brand-logo--large" />
            <div class="mt_primelink-wizard-version-inline">
                <span class="mt_primelink-summary-eyebrow"><?php esc_html_e( 'Version', 'primelink' ); ?></span>
                <strong><?php echo esc_html( MT_PRIMELINK_VERSION ); ?></strong>
            </div>
        </div>
        <div class="mt_primelink-dashboard__headline">
            <?php if ( $header_eyebrow ) : ?>
                <span class="mt_primelink-summary-eyebrow"><?php echo esc_html( $header_eyebrow ); ?></span>
            <?php endif; ?>

            <?php if ( $header_title ) : ?>
                <h1><?php echo esc_html( $header_title ); ?></h1>
            <?php endif; ?>

            <?php if ( $header_description ) : ?>
                <p class="muted"><?php echo esc_html( $header_description ); ?></p>
            <?php endif; ?>

            <?php if ( $header_status_label || $header_release_url ) : ?>
                <div class="mt_primelink-dashboard__meta">
                    <?php if ( $header_status_label ) : ?>
                        <span class="mt_primelink-status-pill <?php echo $header_status_class ? esc_attr( $header_status_class ) : 'mt_primelink-status-idle'; ?>">
                            <?php echo esc_html( $header_status_label ); ?>
                        </span>
                    <?php endif; ?>

                    <?php if ( $header_release_url ) : ?>
                        <a class="mt_primelink-release-link" href="<?php echo esc_url( $header_release_url ); ?>" target="_blank" rel="noopener">
                            <?php echo $header_release_label ? esc_html( $header_release_label ) : esc_html__( 'Learn more', 'primelink' ); ?>
                        </a>
                    <?php endif; ?>
                </div>
            <?php endif; ?>
        </div>
    </div>

    <div class="mt_primelink-dashboard__right">
        <?php if ( $header_actions ) : ?>
            <div class="mt_primelink-dashboard__actions">
                <?php
                // Actions are built per-page with proper escaping; we output raw here.
                // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
                echo $header_actions;
                ?>
            </div>
        <?php endif; ?>
    </div>
</div>


