<?php
/**
 * Setup wizard: choose categories and import sample data.
 *
 * @package Lucrativeit_Subscription_Recurring_Billing
 */

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

// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Included template; variables are local to the including scope.

$category_choices   = LUCRSURE_Demo_Data::get_category_choices();
$default_categories = LUCRSURE_Demo_Data::get_default_setup_categories();
?>

<div class="lucrsure-setup-wizard" id="lucrsure-setup-wizard">
	<div class="lucrsure-setup-wizard-panel">
		<div class="lucrsure-setup-wizard-head">
			<div class="lucrsure-setup-wizard-icon" aria-hidden="true">&#9733;</div>
			<div>
				<h1 id="lucrsure-setup-wizard-title"><?php echo esc_html( sprintf( /* translators: %s: plugin name */ __( 'Set up %s', 'lucrativeit-subscription-recurring-billing' ), lucrsure_plugin_name() ) ); ?></h1>
				<p><?php esc_html_e( 'Import sample data to get started quickly, or begin with a blank workspace.', 'lucrativeit-subscription-recurring-billing' ); ?></p>
			</div>
		</div>

		<div class="lucrsure-setup-wizard-body" id="lucrsure-setup-wizard-body">
			<div class="lucrsure-setup-step lucrsure-setup-step-choose">
				<div class="lucrsure-setup-toolbar">
					<strong><?php esc_html_e( 'Choose categories to import', 'lucrativeit-subscription-recurring-billing' ); ?></strong>
				</div>

				<div class="lucrsure-setup-category-grid">
					<?php foreach ( $category_choices as $slug => $choice ) : ?>
						<label class="lucrsure-setup-category-card">
							<input type="checkbox" class="lucrsure-setup-category-input" name="lucrsure_setup_categories[]" value="<?php echo esc_attr( $slug ); ?>" <?php checked( in_array( $slug, $default_categories, true ) ); ?> />
							<span class="lucrsure-setup-category-inner">
								<strong><?php echo esc_html( $choice['name'] ); ?></strong>
								<span class="lucrsure-muted"><?php echo esc_html( $choice['description'] ); ?></span>
								<span class="lucrsure-setup-category-meta">
									<?php
									echo esc_html(
										sprintf(
											/* translators: %d: plan count */
											_n( '%d plan', '%d plans', (int) $choice['plan_count'], 'lucrativeit-subscription-recurring-billing' ),
											(int) $choice['plan_count']
										)
									);
									?>
									&middot;
									<?php esc_html_e( 'All billing types', 'lucrativeit-subscription-recurring-billing' ); ?>
								</span>
							</span>
						</label>
					<?php endforeach; ?>
				</div>

				<p class="lucrsure-setup-note lucrsure-muted">
					<?php esc_html_e( 'Only the categories you select will be imported — their plans, sample customers, subscriptions, invoices, and public page. Other categories are skipped.', 'lucrativeit-subscription-recurring-billing' ); ?>
				</p>
			</div>

			<div class="lucrsure-setup-step lucrsure-setup-step-progress" id="lucrsure-setup-progress" hidden>
				<div class="lucrsure-demo-import-progress-head">
					<strong id="lucrsure-demo-import-label"><?php esc_html_e( 'Preparing import…', 'lucrativeit-subscription-recurring-billing' ); ?></strong>
					<span id="lucrsure-demo-import-percent">0%</span>
				</div>
				<div class="lucrsure-demo-import-bar" aria-hidden="true">
					<div class="lucrsure-demo-import-bar-fill" id="lucrsure-demo-import-bar-fill"></div>
				</div>
				<p class="lucrsure-demo-import-status" id="lucrsure-demo-import-status"></p>
			</div>
		</div>

		<div class="lucrsure-setup-wizard-foot" id="lucrsure-setup-wizard-foot">
			<button type="button" class="lucrsure-btn lucrsure-btn-ghost" id="lucrsure-setup-dismiss-btn"><?php esc_html_e( 'Start with empty data', 'lucrativeit-subscription-recurring-billing' ); ?></button>
			<button type="button" class="lucrsure-btn lucrsure-btn-primary" id="lucrsure-import-demo-btn"><?php esc_html_e( 'Import selected data', 'lucrativeit-subscription-recurring-billing' ); ?></button>
		</div>
	</div>
</div>
