<?php

namespace ESCT\App;

use ESCT\App\Controllers\Subscription;
use EDPW\Core\Helpers\Plugin;

defined( 'ABSPATH' ) || exit;

class Router {

	/**
	 * Init addon hooks.
	 *
	 * @return void
	 */
	public static function init() {
		if ( ! Plugin::isInternalAddonActive( 'esct-subscription-compatibility' ) ) {
			return;
		}
		if ( is_admin() ) {
			add_action( 'admin_menu', [ Subscription::class, 'addAdminMenu' ] );
			add_action( 'admin_footer', [ Subscription::class, 'hideMenu' ] );
		}
		if ( \EDPW\Core\Helpers\Plugin::isActive( 'woocommerce-subscriptions/woocommerce-subscriptions.php' ) ) {
			add_filter( 'edpw_templates_image_list', [
				Subscription::class,
				'addTemplateImage'
			], 10, 3 );
			add_filter( 'edpw_template_path', [ Subscription::class, 'addTemplatePath' ], 10, 2 );
			add_filter( 'edpw_short_code_list', [ Subscription::class, 'addShortCodes' ], 10, 2 );
			add_filter( 'edpw_after_template_short_codes', [
				Subscription::class,
				'getTemplateShortCodes'
			], 10, 4 );
			add_filter( 'edpw_dummy_data', [ Subscription::class, 'addDummyData' ], 10, 2 );
			add_filter( 'edpw_template_plugin_tag', [ Subscription::class, 'getTagDetails' ], 10, 2 );
			add_filter( 'edpw_email_template_groups', [ Subscription::class, 'addToGroups' ] );
		}
	}
}