<?php

namespace EDPW\Pro;

use EDPW\Pro\Controllers\Admin\CustomBlocks;
use EDPW\Pro\Controllers\Common;
use EDPW\Pro\Controllers\License;

defined( 'ABSPATH' ) || exit;

class Router {
	/**
	 * Init Pro hooks.
	 * @return void
	 */
	public static function init() {
		\EDPW\Pro\Helpers\License::init();
		add_filter( 'edpw_is_pro', [ Common::class, 'isPro' ] );
		add_filter( 'edpw_add_on_init', [ Common::class, 'addProInBuildAddon' ] );
		add_action( 'wp_ajax_edpw_get_saved_blocks', [ CustomBlocks::class, 'getCustomBlocks' ] );
		add_action( 'wp_ajax_edpw_save_block', [ CustomBlocks::class, 'saveCustomBlock' ] );
		add_action( 'wp_ajax_edpw_delete_saved_block', [ CustomBlocks::class, 'deleteCustomBlock' ] );
		add_action( 'wp_ajax_edpw_edit_save_block', [ CustomBlocks::class, 'editCustomBlock' ] );
		if ( is_admin() ) {
			add_action( 'in_admin_header', [ License::class, 'showHeaderNotice' ] );
		}
		add_action( 'wp_ajax_edpw_activate_license', [ License::class, 'activate' ] );
		add_action( 'wp_ajax_edpw_deactivate_license', [ License::class, 'deActivate' ] );
		add_action( 'wp_ajax_edpw_check_license_status', [ License::class, 'checkStatus' ] );
		add_filter( 'edpw_settings_data', [ License::class, 'getLicenseStatus' ] );
		add_filter( 'edpw_before_save_settings', [ License::class, 'getLicenseCheckStatus' ] );
		add_filter( 'edpw_external_add_on_status', [ Common::class, 'toggleProAddonActivate' ], 10, 4 );
		add_filter( 'edpw_template_path', [ Common::class, 'updateTemplatePath' ], 10, 2 );
		add_filter( 'edpw_templates_list', [ Common::class, 'enableProTemplates' ], 10, 3 );
	}
}