<?php

namespace Simple_Giveaways;

/**
 * Class SG_Giveaway_Logged_In
 */
class SG_Giveaway_Logged_In extends SG_Giveaway {

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

	/**
	 * Is this Giveaway open for subscriptions?
	 *
	 * @return bool
	 */
	public function is_open_to_subscribe() {
		$open = false;

		if ( is_user_logged_in() ) {
			$open = true;
		}

		return apply_filters( 'sg_giveaway_open_to_subscribe', $open, $this );

	}

	/**
	 * Return the reason for a closed giveaway.
	 *
	 * @return string
	 */
	public function get_not_open_reason() {
		return __( 'This Giveaway is open only for logged in users.', 'giveasap' );
	}
}
