<?php
/**
 * Evergreen Giveaway Type.
 *
 * This giveaway will always run.
 */

namespace Simple_Giveaways;

use GiveASAP_Front;

/**
 * Class SG_Giveaway_Simple
 */
class SG_Giveaway_Evergreen extends SG_Giveaway {

	/**
	 * @var string
	 */
	protected $type = 'evergreen';

	/**
	 * @var array
	 */
	protected $supports = array(
		'winner_threshold',
	);

	/**
	 * Check if the giveaway has ended.
	 *
	 * @return bool
	 */
	public function has_ended() {
		return false;
	}

	/**
	 *
	 * @param GiveASAP_Front $front
	 */
	public function get_header_message( $front ) {
		if ( $front->get_step() === 2 ) {
			$prize = $this->get_prize_settings();
			if ( isset( $prize['winner_threshold'] ) && $prize['winner_threshold'] ) {
				return sprintf( __( 'Collect %d entries to win', 'giveasap' ), $prize['winner_threshold'] );
			}
		}

		return false;
	}
}
