<?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';
			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';

			// Register all gateways
			$registrar->registerGateway(BayarcashGateway::class);
			$registrar->registerGateway(BayarcashDuitnowGateway::class);
			$registrar->registerGateway(BayarcashLineCreditGateway::class);
			$registrar->registerGateway(BayarcashDuitnowQRGateway::class);
			$registrar->registerGateway(BayarcashDuitnowShopeeGateway::class);
			$registrar->registerGateway(BayarcashDuitnowBoostGateway::class);
			$registrar->registerGateway(BayarcashDuitnowQRISGateway::class);
			$registrar->registerGateway(BayarcashDuitnowQRISWalletGateway::class);
		});
	}

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

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