<?php
/**
 * Health Assistant functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package Health Assistant
 */


if ( ! function_exists( 'health_assistant_setup' ) ) :
	function health_assistant_setup() {

		load_theme_textdomain( 'health-assistant', get_template_directory() . '/languages' );

		add_theme_support( 'automatic-feed-links' );
		add_theme_support( 'align-wide' );
		add_theme_support( 'woocommerce' );
		add_theme_support( 'wp-block-styles' );
		add_theme_support(
			'custom-logo',
			array(
				'height'      => 192,
				'width'       => 192,
				'flex-width'  => true,
				'flex-height' => true,
			)
		);
		add_theme_support( 'block-nav-menus' );
		add_theme_support( 'experimental-link-color' );
		register_nav_menus(
			array(
				'primary' => __( 'Primary Navigation', 'health-assistant' ),
			)
		);

		// Enqueue editor styles.
		add_editor_style(get_stylesheet_directory_uri() . '/css/editor-style.css');
	}
endif;
add_action( 'after_setup_theme', 'health_assistant_setup' );

/**
 * Enqueue scripts and styles.
 */
function health_assistant_scripts() {

	$min  = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';

	$theme_version = wp_get_theme()->get( 'Version' );

	$deps = array( 'dashicons' );
	global $wp_styles;
	if ( in_array( 'wc-blocks-vendors-style', $wp_styles->queue ) ) {
		$deps[] = 'wc-blocks-vendors-style';
	}

	wp_enqueue_style( 'health-assistant-style', get_stylesheet_uri(), $deps, date( 'Ymd-Gis', filemtime( get_theme_file_path( 'style.css' ) ) ) );
	wp_style_add_data('health-assistant', 'rtl', 'replace');

	wp_enqueue_style( 'fontawesome-style', esc_url(get_template_directory_uri()).'/css/fontawesome/css/all.css' );

	wp_enqueue_style( 'animatecss', esc_url(get_template_directory_uri()) . '/css/animate.css');

	wp_enqueue_script( 'wow-script', esc_url(get_template_directory_uri()) . '/js/wow.js', array('jquery'));

	wp_enqueue_script('health-assistant-main-script', esc_url(get_template_directory_uri()) . '/js/script.js', array('jquery'), true);

}
add_action( 'wp_enqueue_scripts', 'health_assistant_scripts' );

/**
 * Enqueue admin scripts and styles.
 */
function health_assistant_admin_scripts() {

	wp_enqueue_style(
		'health-assistant-admin-css',
		get_template_directory_uri() . '/notice-getstart/theme-info.css',
		[],
		wp_get_theme()->get( 'Version' )
	);

	// Enqueue JS
	wp_enqueue_script(
		'health-assistant-admin-js',
		get_template_directory_uri() . '/notice-getstart/theme-info.js',
		[],
		wp_get_theme()->get( 'Version' ),
		true // Load in footer
	);

}
add_action( 'admin_enqueue_scripts', 'health_assistant_admin_scripts' );

/**
 * Load core file.
 */
require_once get_template_directory() . '/core/init.php';

/**
 * TGM
 */
require_once get_template_directory() . '/core/tgm/tgm.php';

/** 
 * Customizer
 */
require get_template_directory() . '/core/section-pro/customizer.php';

/** 
 * Animation
 */

// require get_template_directory() . '/animation-setting.php';

/**
 * Current theme path.
 * Current theme url.
 * Current theme version.
 * Current theme name.
 * Current theme option name.
 */
define( 'HEALTH_ASSISTANT_PATH', trailingslashit( get_template_directory() ) );
define( 'HEALTH_ASSISTANT_URL', trailingslashit( get_template_directory_uri() ) );
define( 'HEALTH_ASSISTANT_VERSION', '1.0.0' );
define( 'HEALTH_ASSISTANT_THEME_NAME', 'health-assistant' );
define( 'HEALTH_ASSISTANT_OPTION_NAME', 'health-assistant' );

/**
 * The core theme class that is used to define internationalization,
 * admin-specific hooks, and public-facing site hooks.
 */
require HEALTH_ASSISTANT_PATH . 'notice-getstart/main.php';

/**
 * Begins execution of the theme.
 *
 * @since    1.0.0
 */
function health_assistant_run() {
	new health_assistant();
}
health_assistant_run();