<?php

namespace SugarCalendarBookings\Services\SmartTags;

use SugarCalendarBookings\Services\ServiceModel;
use SugarCalendarBookings\Support\SmartTags\SmartTagInterface;

/**
 * Service Name smart tag.
 *
 * @since 1.0.0
 */
class ServiceNameSmartTag implements SmartTagInterface {

	/**
	 * Service model instance.
	 *
	 * @since 1.0.0
	 *
	 * @var ServiceModel
	 */
	private $service;

	/**
	 * Constructor.
	 *
	 * @since 1.0.0
	 *
	 * @param ServiceModel $service Service model instance.
	 */
	public function __construct( ServiceModel $service ) {

		$this->service = $service;
	}

	/**
	 * Get the smart tag key.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public function get_key() {

		return '{service_name}';
	}

	/**
	 * Get the smart tag value.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public function get_value() {

		return $this->service->name ?? '';
	}
}
