<?php
if ( ! defined( 'ABSPATH' ) ) {
	// Exit if accessed directly.
	exit;
}

if ( ! function_exists( 'qode_badges_for_woocommerce_add_general_options' ) ) {
	/**
	 * Function that add general options for this module
	 */
	function qode_badges_for_woocommerce_add_general_options( $page ) {

		if ( $page ) {

			$welcome_section = $page->add_section_element(
				array(
					'layout'      => 'welcome',
					'name'        => 'qode_badges_for_woocommerce_global_plugins_options_welcome_section',
					'title'       => esc_html__( 'Welcome to Qode Badges for WooCommerce', 'qode-badges-for-woocommerce' ),
					'description' => esc_html__( 'It\'s time to set up the Badge feature on your website', 'qode-badges-for-woocommerce' ),
					'icon'        => QODE_BADGES_FOR_WOOCOMMERCE_ASSETS_URL_PATH . '/img/icon.png',
				)
			);

			// Hook to include additional options after module options.
			do_action( 'qode_badges_for_woocommerce_action_before_global_options_map', $page );

			$page->add_field_element(
				array(
					'field_type'    => 'yesno',
					'name'          => 'qode_badges_for_woocommerce_hide_sale_badge',
					'title'         => esc_html__( 'Hide WooCommerce Sale Badge', 'qode-badges-for-woocommerce' ),
					'description'   => esc_html__( 'Enable to hide the default WooCommerce "On sale" badge.', 'qode-badges-for-woocommerce' ),
					'default_value' => 'no',
				)
			);

			$page->add_field_element(
				array(
					'field_type'    => 'yesno',
					'name'          => 'qode_badges_for_woocommerce_show_badges_in_widgets',
					'title'         => esc_html__( 'Show Badges in Widgets', 'qode-badges-for-woocommerce' ),
					'description'   => esc_html__( 'Enable to show badges in widgets.', 'qode-badges-for-woocommerce' ),
					'default_value' => 'no',
				)
			);

			do_action( 'qode_badges_for_woocommerce_action_framework_after_general_options_map', $page );
		}
	}

	add_action( 'qode_badges_for_woocommerce_action_default_options_init', 'qode_badges_for_woocommerce_add_general_options' );
}
