<?php
/**
 * First-run Quick Start setup card. Shown on the dashboard until dismissed.
 * Expects $is_empty from the dashboard scope.
 *
 * @package TrustLens\Admin\Views
 * @since   1.2.6
 */

defined( 'ABSPATH' ) || exit;

// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template variables scoped to included view file.

// Defensive: this partial expects $is_empty from the dashboard scope. Guard so
// it never emits an undefined-variable notice if included from elsewhere.
$wstl_qs_is_empty      = isset( $is_empty ) ? (bool) $is_empty : true;
$wstl_qs_blocking      = (bool) get_option( 'trustlens_enable_blocking', false );
$wstl_qs_notifications = (bool) get_option( 'trustlens_enable_notifications', false );
$wstl_qs_has_customers = ! $wstl_qs_is_empty;
?>
<div class="wstl-dashboard-section">
	<div class="wstl-quickstart" id="wstl-quickstart">
		<div class="wstl-quickstart-head">
			<div>
				<h2 class="wstl-quickstart-title"><?php esc_html_e( 'Quick start', 'trustlens' ); ?></h2>
				<p class="wstl-quickstart-sub"><?php esc_html_e( 'A few quick choices to get TrustLens working for your store. You can change any of these later in Settings.', 'trustlens' ); ?></p>
			</div>
			<button type="button" class="button-link wstl-quickstart-dismiss" id="wstl-quickstart-dismiss"><?php esc_html_e( 'Hide', 'trustlens' ); ?></button>
		</div>

		<ul class="wstl-quickstart-steps">
			<li class="wstl-quickstart-step">
				<label class="wstl-quickstart-toggle">
					<input type="checkbox" class="wstl-quickstart-setting" data-setting="blocking" <?php checked( $wstl_qs_blocking ); ?>>
					<span class="wstl-quickstart-text">
						<strong><?php esc_html_e( 'Block risky customers at checkout', 'trustlens' ); ?></strong>
						<span class="wstl-quickstart-desc"><?php esc_html_e( 'Lets you block specific customers from completing checkout. Nothing is ever auto-blocked — you stay in control.', 'trustlens' ); ?></span>
					</span>
				</label>
			</li>
			<li class="wstl-quickstart-step">
				<label class="wstl-quickstart-toggle">
					<input type="checkbox" class="wstl-quickstart-setting" data-setting="notifications" <?php checked( $wstl_qs_notifications ); ?>>
					<span class="wstl-quickstart-text">
						<strong><?php esc_html_e( 'Email me about attacks & high-risk customers', 'trustlens' ); ?></strong>
						<span class="wstl-quickstart-desc"><?php esc_html_e( 'Get a heads-up when a card-testing attack hits or a high-risk order comes in.', 'trustlens' ); ?></span>
					</span>
				</label>
			</li>
			<li class="wstl-quickstart-step">
				<span class="wstl-quickstart-toggle">
					<?php if ( $wstl_qs_has_customers ) : ?>
						<span class="wstl-quickstart-check dashicons dashicons-yes"></span>
						<span class="wstl-quickstart-text">
							<strong><?php esc_html_e( 'Your customers are being scored', 'trustlens' ); ?></strong>
							<span class="wstl-quickstart-desc"><?php esc_html_e( 'TrustLens is analysing your store. New orders are scored automatically.', 'trustlens' ); ?></span>
						</span>
					<?php else : ?>
						<span class="wstl-quickstart-check dashicons dashicons-database-import"></span>
						<span class="wstl-quickstart-text">
							<strong><?php esc_html_e( 'Import your past orders', 'trustlens' ); ?></strong>
							<span class="wstl-quickstart-desc">
								<?php esc_html_e( 'Score your existing customers from order history.', 'trustlens' ); ?>
								<a href="<?php echo esc_url( admin_url( 'admin.php?page=trustlens-settings&tab=data' ) ); ?>"><?php esc_html_e( 'Go to import', 'trustlens' ); ?> &rarr;</a>
							</span>
						</span>
					<?php endif; ?>
				</span>
			</li>
		</ul>
	</div>
</div>
<?php // phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound ?>
