<?php
/**
 * @package DJ-Catalog2-Yootheme
 * @copyright Copyright (C) DJ-Extensions.com, All rights reserved.
 * @license http://www.gnu.org/licenses GNU/GPL
 * @author url: http://dj-extensions.com
 * @author email contact@dj-extensions.com
 */

namespace DJExtensions\DJCatalog2\YOOtheme\Builder\Source\Type;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;

class SiteQueryType
{
	/**
	 * @return array
	 */
	public static function config()
	{
		return [

			'fields' => [

				'site' => [
					'type' => 'Site',
					'metadata' => [
						'label' => 'Site',
					],
					'extensions' => [
						'call' => __CLASS__ . '::resolve',
					],
				],

			]

		];
	}

	public static function resolve()
	{
		$config = Factory::getConfig();
		$document = Factory::getDocument();

		return [
			'title' => $config->get('sitename'),
			'page_title' => $document->getTitle(),
		];
	}
}
