<?php
/**
 * REST API for the Credorax gateway.
 *
 * @package flo-checkout
 */

namespace Flo_Checkout;

use Flo_Checkout\Gateways\Apple_Pay\Frontend_REST\Payment_Request_Route as Apple_Pay_Payment_Request_Route;
use Flo_Checkout\Gateways\Apple_Pay\Frontend_REST\Validate_Merchant_Route as Apple_Pay_Validate_Merchant_Route;
use Flo_Checkout\Gateways\Credorax\REST_Routes\Shift4_3DS_Notification;
use Northmill_Online_Shared_Checkout\Northmill_Online_Shared\Abstracts\REST\Abstract_API;
use Northmill_Online_Shared_Checkout\Northmill_Online_Shared\Traits\Singleton_Trait;

defined( 'ABSPATH' ) || exit;

/**
 * Class REST_API
 */
class REST_API extends Abstract_API {
	use Singleton_Trait;

	/**
	 * Used statically in:
	 *  - assets/src/gateway-blocks/Components/ApplePay/ApplePayContent.js
	 *  - Northmill Express Order plugin.
	 */
	public const REST_NAMESPACE = 'northmill/checkout';

	/**
	 * {@inheritDoc}
	 */
	public function get_rest_namespace(): string {
		return self::REST_NAMESPACE;
	}

	/**
	 * {@inheritDoc}
	 */
	public function construct_routes(): void {
		$this->store_route( new Shift4_3DS_Notification( $this ) );
		$this->store_route( new Apple_Pay_Payment_Request_Route( $this ) );
		$this->store_route( new Apple_Pay_Validate_Merchant_Route( $this ) );
	}

	/**
	 * Retrieves an array of routes that are used for loading WooCommerce.
	 *
	 * @return array An array of route strings used for loading WooCommerce.
	 */
	public function get_routes_loading_wc(): array {
		return array(
			'/v1/apple-pay/payment-request',
		);
	}
}
