<?php
/*
 * Software Name: Eorisis Setup
 * Software URI: https://eorisis.com/shop/software/joomla/setup
 * Author: Eorisis
 * Author URI: https://eorisis.com
 * Copyright: Copyright (C) 2011-2025 EORISIS. All Rights Reserved.
 * License: GNU General Public License version 2; See https://eorisis.com/gpl
 * Terms of Service: https://eorisis.com/tos
 */
namespace eorisis_setup\framework\lib\core\view;
\defined('_JEXEC') or die;

use eorisis_setup\framework\lib\core\app\config as app_config;
use eorisis_setup\framework\lib\core\cms\language as cms_language;
use eorisis_setup\framework\lib\core\view\link;

class basic
{
	public function __construct() {}

	// --------------------------------------------------

	public static function html() : string
	{
		app_config::init();

		$html  = '<div class="eo-info">';
		$html .=	'<div class="ext-img">'.self::extension_img().'</div>';
		$html .=	'<span class="group">';
		$html .=		'<h4>'.self::link('https://eorisis.com'.self::language_uri().app_config::get('app_uri'), cms_language::text('EO_APP_PAGE')).'</h4>';
		$html .=		'<h5>';
		$html .=			'Eorisis '.cms_language::text('EO_APPS_FOR_JOOMLA_WORDPRESS').': ';
		$html .=			self::link('https://eorisis.com'.self::language_uri().'/shop/software/');
		$html .=		'</h5>';
//		$html .=		'<h5>';
//		$html .=			cms_language::text('EO_SUPPORT_DEV').': '.self::link('https://eorisis.com'.self::language_uri().'/donate', cms_language::text('EO_MAKE_DONATION'));
//		$html .=		'</h5>';
		$html .=		'<h5>'.\str_replace('(C)', '&copy;', app_config::get('copyright')).'</h5>';
		$html .=		'<div class="social">'.self::network_links().'</div>';
		$html .=	'</span>';
		$html .= '</div>';
		return $html;
	}

	// --------------------------------------------------

	private static function network_links() : string
	{
		$img_dir = app_config::media_uri_relative(false).'/assets/images';
		$html = '';

		// --------------------------------------------------

		// Contact Support
		$arguments = [
			'content' => link::img($img_dir.'/help-circle-solid.svg', ['alt' => 'support', 'class' => 'help']),
			'target' => '_blank',
			'title' => cms_language::text('EO_CONTACT_SUPPORT')
		];
		$html .= link::a('https://eorisis.com'.self::language_uri().'/contact/support', $arguments);

		// --------------------------------------------------

		// Receive Newsletters
//		$arguments = [
//			'content' => link::img($img_dir.'/mail-in.svg', ['alt' => 'newsletter']),
//			'target' => '_blank',
//			'title' => cms_language::text('EO_RECEIVE_NEWSLETTERS')
//		];
//		$html .= link::a('https://eorisis.com'.self::language_uri().'/mailing-list', $arguments);

		// --------------------------------------------------

		// Visit the website
		$arguments = [
			'content' => link::img($img_dir.'/internet.svg', ['alt' => 'website']),
			'target' => '_blank',
			'title' => cms_language::text('EO_VISIT_THE_WEBSITE')
		];
		$html .= link::a('https://eorisis.com/'.self::language_uri(), $arguments);

		// --------------------------------------------------

		// Linkedin
		$arguments = [
			'content' => link::img($img_dir.'/linkedin.svg', ['alt' => 'linkedin']),
			'target' => '_blank',
			'title' => cms_language::text('EO_FOLLOW_ON_LINKEDIN')
		];
		$html .= link::a('https://www.linkedin.com/company/eorisis', $arguments);

		// --------------------------------------------------

		// Facebook
		$arguments = [
			'content' => link::img($img_dir.'/facebook.svg', ['alt' => 'facebook']),
			'target' => '_blank',
			'title' => cms_language::text('EO_FOLLOW_ON_FACEBOOK')
		];
		$html .= link::a('https://www.facebook.com/eorisis', $arguments);

		// --------------------------------------------------

		// Youtube
		$arguments = [
			'content' => link::img($img_dir.'/youtube.svg', ['alt' => 'youtube']),
			'target' => '_blank',
			'title' => cms_language::text('EO_SUBSCRIBE_ON_YOUTUBE')
		];
		$html .= link::a('https://www.youtube.com/@eorisis', $arguments);

		return $html;
	}

	// --------------------------------------------------

	private static function extension_img() : string
	{
		$src = app_config::media_uri_relative(false).'/assets/images/extension-logo.jpg';
		$content = link::img($src, [
			'alt' => 'Extension Logo',
			'version' => true
		]);
		$arguments = [
			'content' => $content,
			'target' => '_blank',
			'title' => cms_language::text('EO_VISIT_MAIN_PAGE')
		];
		return link::a('https://eorisis.com'.app_config::get('app_uri'), $arguments);
	}

	// --------------------------------------------------

	private static function language_uri() : string
	{
		static $val = null;
		if ($val === null)
		{
			$val = cms_language::current_tag() == 'el-GR' ? '/el' : '';
		}

		return $val;
	}

	// --------------------------------------------------

	private static function link(string $uri, string $content = '') : string
	{
		$arguments = [
			'title' => cms_language::text('JBROWSERTARGET_NEW'),
			'content' => $content,
			'target' => '_blank'
		];
		return link::a($uri, $arguments);
	}
}
