<?php

namespace NeurogenesisTheme\Core\Admin\Actions;

use NeurogenesisTheme\QuickSetup\Steps\CustomizeTheme;

defined( 'ABSPATH' ) || exit;

/**
 * Marks the Quick Setup customize step complete when the Customizer is saved.
 */
final class MarkCustomizeStepComplete {

	public function __construct() {
		add_action( 'customize_save_after', array( $this, 'handle' ) );
	}

	public function handle( \WP_Customize_Manager $wp_customize ): void {
		if ( ! current_user_can( 'edit_theme_options' ) ) {
			return;
		}

		CustomizeTheme::mark_completed();
	}
}
