<?php
if ( ! class_exists( 'braapf_paid_funnels' ) ) {
	class braapf_paid_funnels {
		function __construct() {
			//delete_option('berocket_admin_notices');
			$this->premium_to_business();
		}

		public function premium_to_business(): void {
			// check if license is not a business license
			$plugin_version_capability = apply_filters( 'brfr_get_plugin_version_capability_ajax_filters', 0 );
			if ( $plugin_version_capability >= 15 and $plugin_version_capability < 100 ) {
				//*
				new berocket_admin_notices( array(
					'start'     => time() + 60 * 60 * 24 * 7,
					'end'       => time() + 60 * 60 * 24 * 14,
					'name'      => 'filters_7_to_business_settings',
					'html'      => '
				<div>
					<h2>Using Product Filters as part of your store UX & SEO?</h2>
					<p style="margin-right: 180px;">Business includes priority support and advanced control over filter design and SEO content.</p>
					<a href="https://berocket.com/l/filters-business/?utm_source=paid_plugin&utm_medium=7_to_business&utm_campaign=ajax_filters" 
					   class="button notice-action-link not_berocket_button" target="_blank" style="margin: 0;">Learn about Business</a>
				</div>',
					'type'      => 'warning',
					'righthtml' => '<span class="berocket-notice-dismiss notice-dismiss berocket_no_thanks" role="button" tabindex="0">
						<span class="screen-reader-text">
						<input class="berocket-notice-dismiss-check" type="checkbox" value="1">Dismiss this notice.
						</span>
					</span>',
					'subscribe' => false,
					'priority'  => 25,
					'image'     => '',
				) );

				new berocket_admin_notices( array(
					'start'     => time() + 60 * 60 * 24 * 14,
					'end'       => time() + 60 * 60 * 24 * 30,
					'name'      => 'filters_7_to_business_admin',
					'html'      => '
				<div>
					<h2>Using Product Filters as part of your store UX & SEO?</h2>
					<p style="margin-right: 180px;">Business includes priority support and advanced control over filter design and SEO content.</p>
					<a href="https://berocket.com/l/filters-business/?utm_source=paid_plugin&utm_medium=7_to_business&utm_campaign=ajax_filters" 
					   class="button notice-action-link not_berocket_button" target="_blank" style="margin: 0;">Learn about Business</a>
				</div>',
					'type'      => 'warning',
					'righthtml' => '<span class="berocket-notice-dismiss notice-dismiss berocket_no_thanks" role="button" tabindex="0">
						<span class="screen-reader-text">
						<input class="berocket-notice-dismiss-check" type="checkbox" value="1">Dismiss this notice.
						</span>
					</span>',
					'subscribe' => false,
					'priority'  => 6,
					'image'     => '',
					'conditions' => array(
						'plugin_id' => 1, //plugin ID that used to check plugin_version_capability
						'plugin_version_capability' => [15,100],//show notice only when version_capability between
						'notice_close_status' => array(
							'notice_priority' => '25',//other notice priority
							'notice_name' => 'filters_7_to_business_settings',//other notice name
							'closed' => [1, 2]//other notice closed status required
						),
					)
				) );
			}
		}
	}

	new braapf_paid_funnels();
}