<?php
/**
 * Integration: UnknownIntegration.php.
 *
 * @package RewardsWP
 */

namespace Awesomemotive\Rewardswp\Integrations;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use Awesomemotive\Rewardswp\Interfaces\IntegrationInterface;

/**
 * Fallback integration used when the source is unknown.
 */
class UnknownIntegration implements IntegrationInterface {
	/**
	 * {@inheritDoc}
	 */
	public function get_source(): string {
		return 'unknown';
	}

	/**
	 * {@inheritDoc}
	 */
	public function init(): void {
		return;
	}

	/**
	 * {@inheritDoc}
	 */
	public function is_active(): bool {
		return false;
	}

	/**
	 * {@inheritDoc}
	 *
	 * @param string $email Customer email address.
	 */
	public function is_customer( string $email ): bool {
		return true;
	}

	/**
	 * {@inheritDoc}
	 *
	 * @param int      $user_id  WordPress user ID.
	 * @param int|null $order_id Optional order ID.
	 */
	public function get_customer_url( int $user_id, ?int $order_id = null ): string {
		return esc_html__( 'N/A', 'rewardswp' );
	}

	/**
	 * {@inheritDoc}
	 *
	 * @param int|null $order_id Optional order ID.
	 */
	public function get_customer_name( ?int $order_id = null ): ?string {
		return null;
	}

	/**
	 * {@inheritDoc}
	 *
	 * @param int|null $order_id Optional order ID.
	 */
	public function get_customer_email( ?int $order_id = null ): ?string {
		return null;
	}

	/**
	 * {@inheritDoc}
	 *
	 * @param array $args     Query args.
	 * @param int   $page     Page number.
	 * @param int   $per_page Items per page.
	 */
	public function get_customers( array $args = [], int $page = 1, int $per_page = 10 ): array {
		return [];
	}

	/**
	 * {@inheritDoc}
	 *
	 * @param string $customer_email Customer email.
	 * @param array  $args           Query args.
	 */
	public function get_customer_orders( string $customer_email, array $args = [] ): array {
		return [];
	}

	/**
	 * {@inheritDoc}
	 */
	public function get_store_url(): string {
		return home_url();
	}

	/**
	 * {@inheritDoc}
	 */
	public function get_cart_item_count(): int {
		return 0;
	}

	/**
	 * {@inheritDoc}
	 */
	public function get_checkout_url(): string {
		return '';
	}

	/**
	 * {@inheritDoc}
	 */
	public function get_cart_url(): string {
		return '';
	}

	/**
	 * Check if a coupon has been applied to the cart.
	 *
	 * @param string $coupon_code The coupon code to check.
	 *
	 * @return bool Whether the coupon is applied or not.
	 */
	public function is_coupon_applied( string $coupon_code ): bool {
		return false;
	}

	/**
	 * {@inheritDoc}
	 *
	 * @param int $order_id The order ID.
	 */
	public function get_order_link( int $order_id ): string {
		return '';
	}

	/**
	 * {@inheritDoc}
	 */
	public function get_cart_product_ids(): array {
		return [];
	}

	/**
	 * {@inheritDoc}
	 */
	public function get_cart_subtotal(): float {
		return 0.0;
	}

	/**
	 * {@inheritDoc}
	 *
	 * @since 1.2.0
	 *
	 * @param string $email   The customer email.
	 * @param int    $user_id The WordPress user ID.
	 */
	public function link_guest_orders( string $email, int $user_id ): int {
		return 0;
	}

	/**
	 * {@inheritDoc}
	 *
	 * @since 1.2.0
	 *
	 * @param string $email The customer email.
	 */
	public function count_guest_orders( string $email ): int {
		return 0;
	}

	/**
	 * {@inheritDoc}
	 *
	 * @param string $key   The session key.
	 * @param mixed  $value The value to store.
	 */
	public function set_session( string $key, $value ): bool {
		return false;
	}

	/**
	 * {@inheritDoc}
	 *
	 * @param string $key The session key.
	 */
	public function get_session( string $key ) {
		return null;
	}

	/**
	 * {@inheritDoc}
	 *
	 * @param string $key The session key to clear.
	 */
	public function clear_session( string $key ): bool {
		return false;
	}
}
