<?php

namespace Simple_Giveaways;


/**
 * Class SG_Action_Subscribe
 */
class SG_Action_Referred extends SG_Extra_Action {

	/**
	 * SG_Action_Visit constructor.
	 */
	public function __construct() {
		$this->internal_only = true;
		$this->slug          = 'referred';
		$this->category      = 'general';
		$this->title         = __( 'Referred a User', 'giveasap' );
		$this->description   = __( 'Rewards the user for referring.', 'giveasap' );
		$this->icon          = 'fal fa-user';
	}

	/**
	 * Return the referred subscriber
	 *
	 * @param array $data
	 *
	 * @return string
	 */
	public function get_value_for_entries_table( $data ) {

		if ( isset( $data['user'] ) && is_a( $data['user'], '\Simple_Giveaways\SG_Subscriber' ) ) {
			return sprintf( __( 'Referred: %s', 'giveasap' ), $data['user']->get_email() );
		}
		return '-';
	}

}
