<?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-header-top-right">
        <div class="mt_primelink-wizard-version-inline mt_primelink-wizard-version-inline--top-right">
            <span class="mt_primelink-summary-eyebrow"><?php esc_html_e( 'Version', 'primelink' ); ?></span>
            <strong><?php echo esc_html( MT_PRIMELINK_VERSION ); ?></strong>
        </div>
        <a href="https://docs.malotop.ro/primelink/" target="_blank" rel="noopener" class="mt_primelink-docs-link" title="<?php esc_attr_e( 'Documentation & Support', 'primelink' ); ?>">
            <span class="dashicons dashicons-book-alt"></span>
            <span class="mt_primelink-docs-link-text"><?php esc_html_e( 'Docs', 'primelink' ); ?></span>
        </a>
    </div>
    <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>
        <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="#" data-release-notes-modal>
                            <?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>

<?php
// Include release notes modal if release URL is set
if ( ! empty( $header_release_url ) ) {
    include MT_PRIMELINK_PATH . 'templates/admin/partials/release-notes-modal.php';
}
?>


