<?php
/**
 * Recovered Revenue 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; // @codeCoverageIgnore

use EDD\Reports\Endpoints\Tiles\Tile;

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

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

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

	/**
	 * Gets the tooltip content for the tile.
	 *
	 * @since 3.6.5
	 * @return string
	 */
	protected function get_tooltip(): string {
		return __( 'Total revenue from recovered abandoned carts.', 'easy-digital-downloads' );
	}

	/**
	 * Gets the recovered revenue formatted as a currency amount.
	 *
	 * @since 3.6.5
	 * @return string
	 */
	protected function get_data(): string {
		$stats = $this->get_cart_stats();

		return edd_currency_filter( edd_format_amount( $stats['recovered_value'] ) );
	}
}
