<?php
/**
 * Recovered Carts Tile
 *
 * @package     EDD\Pro\CartRecovery\Admin\Reports\Endpoints\Tiles
 * @copyright   Copyright (c) 2026, Sandhills Development, LLC
 * @license     https://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since       3.6.5
 */

namespace EDD\Pro\CartRecovery\Admin\Reports\Endpoints\Tiles;

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

use EDD\Reports\Endpoints\Tiles\Tile;

/**
 * Recovered Carts Tile class.
 *
 * Displays the number of recovered carts in the selected date range.
 *
 * @since 3.6.5
 */
class Recovered extends Tile {
	use Traits\Carts;

	/**
	 * Gets the tile endpoint ID.
	 *
	 * @since 3.6.5
	 * @return string
	 */
	protected function get_id(): string {
		return 'acr_recovered';
	}

	/**
	 * Gets the tile label for display.
	 *
	 * @since 3.6.5
	 * @return string
	 */
	protected function get_label(): string {
		return __( 'Recovered', 'easy-digital-downloads' );
	}

	/**
	 * Gets the tooltip content for the tile.
	 *
	 * @since 3.6.5
	 * @return string
	 */
	protected function get_tooltip(): string {
		return __( 'Abandoned carts that resulted in completed purchases.', 'easy-digital-downloads' );
	}

	/**
	 * Gets the number of recovered carts in the selected date range.
	 *
	 * @since 3.6.5
	 * @return int
	 */
	protected function get_data(): int {
		$stats = $this->get_cart_stats();

		return $stats['recovered_count'];
	}
}
