<?php
/**
 * Class for Demo Import
 *
 * @package Education_Hub
 */

/**
 * Demo Import class.
 *
 * @since 1.1
 */
class Mediclean_Demo_Import {

	function __construct() {
		add_filter( 'cp-ctdi/import_files', array( $this, 'import_files' ) );
		add_action( 'cp-ctdi/after_import', array( $this, 'after_import_setup' ) );
		add_filter( 'ocdi/import_files', array( $this, 'import_files' ) );
		add_action( 'ocdi/after_import', array( $this, 'after_import_setup' ) );
	}
	function import_files() {
		$customizer_demo_file = get_template_directory_uri() . '/inc/support/ctdi/mediclean-pro.dat';
		if ( class_exists( 'WooCommerce' ) ) {
			$customizer_demo_file = get_template_directory_uri() . '/inc/support/ctdi/mediclean-pro-woo.dat';
		}
		return array(
			array(
				'import_file_name'           => esc_html__( 'Mediclean Pro Demo', 'mediclean-pro' ),
				'import_file_url'            => get_template_directory_uri() . '/inc/support/ctdi/mediclean-pro.xml',
				'import_widget_file_url'     => get_template_directory_uri() . '/inc/support/ctdi/mediclean-pro.wie',
				'import_customizer_file_url' => $customizer_demo_file,
				'import_preview_image_url'   => get_template_directory_uri() . '/screenshot.png',
				'preview_url'                => 'https://wenthemes.com/item/wordpress-themes/mediclean-pro/',
			),
		);
	}

	function after_import_setup() {
		// Assign menus to their locations.
		$main_menu   = get_term_by( 'name', 'Primary Menu', 'nav_menu' );
		$social_menu = get_term_by( 'name', 'Social Menu', 'nav_menu' );
		set_theme_mod(
			'nav_menu_locations',
			array(
				'primary' => $main_menu->term_id,
				'social'  => $social_menu->term_id,
			)
		);
	}
}

// Initialize.
$education_hub_ctdi = new Mediclean_Demo_Import();
