<?php

namespace WLCT\App;

use WLCT\App\Controllers\WPLoyalty;
use EDPW\Core\Helpers\Plugin;

defined( 'ABSPATH' ) || exit;

class Router {

	/**
	 * Init addon hooks.
	 *
	 * @return void
	 */
	public static function init() {
		if ( ! Plugin::isInternalAddonActive( 'wlct-loyalty-compatibility' ) ) {
			return;
		}
		if ( is_admin() ) {
			add_action( 'admin_menu', [ WPLoyalty::class, 'addAdminMenu' ] );
			add_action( 'admin_footer', [ WPLoyalty::class, 'hideMenu' ] );
		}
		if ( Plugin::isActive( 'wp-loyalty-rules/wp-loyalty-rules.php' ) || Plugin::isActive( 'wployalty/wp-loyalty-rules-lite.php' ) ) {
			add_filter( 'edpw_templates_image_list', [
				WPLoyalty::class,
				'addTemplateImage'
			], 10, 3 );

			add_filter( 'edpw_template_path', [ WPLoyalty::class, 'addTemplatePath' ], 10, 2 );
			add_filter( 'edpw_short_code_list', [ WPLoyalty::class, 'addShortCodes' ], 10, 2 );
			add_filter( 'edpw_after_template_short_codes', [
				WPLoyalty::class,
				'getTemplateShortCodes'
			], 10, 4 );

			add_filter( 'edpw_dummy_data', [ WPLoyalty::class, 'addDummyData' ], 10, 2 );
			add_filter( 'edpw_template_plugin_tag', [ WPLoyalty::class, 'getTagDetails' ], 10, 2 );
			add_filter( 'edpw_email_template_groups', [ WPLoyalty::class, 'addToGroups' ] );
			add_filter( 'edpw_disallowed_preview_template_order', [
				WPLoyalty::class,
				'disallowedPreviewOrderTemplates'
			] );
		}
	}
}