<?php
/**
 * Shift4 APMs.
 *
 * @package flo-checkout
 */

namespace Flo_Checkout\Gateways\Shift4_APM\Enums;

defined( 'ABSPATH' ) || exit;

/**
 * Health check APIs.
 */
enum Payment_Method {
	case APPLE_PAY;

	/**
	 * Get the name of the payment method.
	 *
	 * @return string The name of the payment method.
	 */
	public function get_name(): string {
		return match ( $this ) {
			self::APPLE_PAY => __( 'Apple Pay', 'flo-checkout' ),
		};
	}

	/**
	 * Get the payment method from a string.
	 *
	 * @param string $method The string representation of the payment method.
	 *
	 * @return Payment_Method|null The corresponding payment method enum case or null if not found.
	 */
	public static function from_api_string( string $method ): ?self {
		return match ( strtolower( $method ) ) {
			'applepay' => self::APPLE_PAY,
			default => null,
		};
	}
}
