<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! function_exists( 'tami_woocommerce_init' ) ) {
	function tami_woocommerce_init() {

		include TAMI_PLUGIN_PATH . '/lib/Response.php';
		include TAMI_PLUGIN_PATH . '/admin/TamiAdminSettings.php';
		include TAMI_PLUGIN_PATH . '/admin/TamiAdmin.php';
		include TAMI_PLUGIN_PATH . '/admin/TamiAdminOrderDetails.php';
		include TAMI_PLUGIN_PATH . '/checkout/TamiCheckout.php';
		include TAMI_PLUGIN_PATH . '/lib/Debugger.php';

		if(!class_exists('\Tami_WooCommerce_GW'))
			include TAMI_PLUGIN_PATH . '/lib/Tami_WooCommerce_GW.php';

		add_filter( 'woocommerce_payment_gateways', array( \Tami_WooCommerce_GW::class, 'add_method_to_wc' ) );
		add_filter('wp_head', array( \Tami_WooCommerce_GW::class, 'add_head_scripts' ) );

	}
}
if ( ! function_exists( 'tami_woocommerce_block_support' ) ) {
	function tami_woocommerce_block_support() {
		if ( class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) {
			require_once TAMI_PLUGIN_PATH . '/checkout/blocks/Tami.class.php';
			add_action(
				'woocommerce_blocks_payment_method_type_registration',
				function ( Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) {
					$payment_method_registry->register( new TamiWooBlocks() );
				}
			);
		}
	}
}
