<?php
function swp_notary_enqueue_assets() {

    // Theme main stylesheet
    wp_enqueue_style(
        'swp-notary-style',
        get_theme_file_uri('style.css'),
        array(),
        wp_get_theme()->get('Version')
    );

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

add_action('after_setup_theme', function () {
    add_editor_style('editor-style.css');
});

function swp_notary_production_factory_enqueue_fontawesome() {
	wp_enqueue_style(
		'font-awesome',
		get_template_directory_uri() . '/include/fontawesome/css/all.min.css',
		array(),
		'6.5.2'
	);
}
add_action( 'wp_enqueue_scripts', 'swp_notary_production_factory_enqueue_fontawesome' );

// Menus in Admin menu
function swp_notary_setup() {
    add_theme_support( 'menus' );

    register_nav_menus( array(
        'primary' => __( 'Primary Menu', 'swp-notary' ),
    ) );
}
add_action( 'after_setup_theme', 'swp_notary_setup' );

// Owl carousel library
function swp_notary_theme_enqueue_owl_carousel() {

	// Owl Carousel CSS
	wp_enqueue_style(
		'owl-carousel',
		get_theme_file_uri( '/assets/css/owl.carousel.css' ),
		array(),
		null
	);

	// Owl Carousel JS (depends on jQuery)
	wp_enqueue_script(
		'owl-carousel',
		get_theme_file_uri( '/assets/js/owl.carousel.js' ),
		array( 'jquery' ),
		null,
		true
	);

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

// Custom JS file for custom code
function swp_notary_theme_enqueue_custom_js() {
	wp_enqueue_script(
		'theme-custom-js', get_theme_file_uri( '/assets/js/custom.js' ),array(),null,true
	);
}
add_action( 'wp_enqueue_scripts', 'swp_notary_theme_enqueue_custom_js' );

// Register Custom Pattern Category
function swp_notary_register_custom_pattern_cat() {
	register_block_pattern_category(
		'swp-notary',
		array( 'label' => __( 'SWP Notary', 'swp-notary' ) )
	);
}
add_action( 'init', 'swp_notary_register_custom_pattern_cat' );

// Admin promo banner for pro theme.
require_once get_theme_file_path( '/include/admin-promo-banner.php' );

// Register custom block styles for core blocks.
function swp_notary_register_block_styles() {
	if ( ! function_exists( 'register_block_style' ) ) {
		return;
	}

	register_block_style(
		'core/button',
		array(
			'name'         => 'swp-notary-soft-outline',
			'label'        => __( 'Soft Outline', 'swp-notary' ),
			'inline_style' => '.wp-block-button.is-style-swp-notary-soft-outline .wp-block-button__link{border:1px solid #1111d4;background:transparent;color:#1111d4;border-radius:8px;}',
		)
	);
}
add_action( 'init', 'swp_notary_register_block_styles' );
