<?php
use Give\Framework\PaymentGateways\PaymentGatewayRegister;

class Bayarcash_Givewp_Block {
	private static $_instance;

	public static function get_instance() {
		if (static::$_instance == null) {
			static::$_instance = new static();
		}
		return static::$_instance;
	}

	public function __construct() {
		$this->add_actions();
		$this->add_filters();
	}

	public function add_actions() {
		add_action('givewp_register_payment_gateway', function(PaymentGatewayRegister $registrar) {
			// Base Gateway
			require_once dirname(__FILE__) . '/traits/BayarcashPaymentTrait.php';
			require_once dirname(__FILE__) . '/gateways/class-bayarcash-gateway.php';

			// Individual Gateway Classes
			require_once dirname(__FILE__) . '/gateways/class-bayarcash-duitnow-gateway.php';
			require_once dirname(__FILE__) . '/gateways/class-bayarcash-linecredit-gateway.php';
			require_once dirname(__FILE__) . '/gateways/class-bayarcash-duitnowqr-gateway.php';
			// require_once dirname(__FILE__) . '/gateways/class-bayarcash-duitnowshopee-gateway.php'; // Temporarily disabled
			require_once dirname(__FILE__) . '/gateways/class-bayarcash-duitnowboost-gateway.php';
			require_once dirname(__FILE__) . '/gateways/class-bayarcash-duitnowqris-gateway.php';
			require_once dirname(__FILE__) . '/gateways/class-bayarcash-duitnowqriswallet-gateway.php';
			require_once dirname(__FILE__) . '/gateways/class-bayarcash-nets-gateway.php';
			require_once dirname(__FILE__) . '/gateways/class-bayarcash-alipay-gateway.php';
			require_once dirname(__FILE__) . '/gateways/class-bayarcash-wechatpay-gateway.php';
			require_once dirname(__FILE__) . '/gateways/class-bayarcash-promptpay-gateway.php';

			// Register all gateways
			$registrar->registerGateway(BayarcashGateway::class);
			$registrar->registerGateway(BayarcashDuitnowGateway::class);
			$registrar->registerGateway(BayarcashLineCreditGateway::class);
			$registrar->registerGateway(BayarcashDuitnowQRGateway::class);
			// $registrar->registerGateway(BayarcashDuitnowShopeeGateway::class); // Temporarily disabled
			$registrar->registerGateway(BayarcashDuitnowBoostGateway::class);
			$registrar->registerGateway(BayarcashDuitnowQRISGateway::class);
			$registrar->registerGateway(BayarcashDuitnowQRISWalletGateway::class);
			$registrar->registerGateway(BayarcashNetsGateway::class);
			$registrar->registerGateway(BayarcashAlipayGateway::class);
			$registrar->registerGateway(BayarcashWechatPayGateway::class);
			$registrar->registerGateway(BayarcashPromptPayGateway::class);
		});
	}

	public function add_filters() {
		// Add filters if needed
	}
}

// Initialize the class
Bayarcash_Givewp_Block::get_instance();