<?php
/**
 * More Plugins administration page.
 *
 * @package TitaniumMailSMTP
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Renders the shared Titanium plugin showcase.
 */
final class TMSMTP_More_Plugins {

	/**
	 * Renders the Titanium plugin showcase.
	 *
	 * @return void
	 */
	public function render() {
		$plugins = $this->get_plugins();
		?>
		<section class="titanium-mm-more-plugins-showcase">
			<header class="titanium-mm-more-plugins-hero">
				<div class="titanium-mm-more-plugins-hero-copy">
					<span class="titanium-mm-more-plugins-suite-label">
						<?php esc_html_e( 'AdminPlugins Titanium Suite', 'titanium-mail-smtp' ); ?>
					</span>
					<h2>
						<span><?php esc_html_e( 'Next-generation', 'titanium-mail-smtp' ); ?></span>
						<?php esc_html_e( 'WordPress', 'titanium-mail-smtp' ); ?><br>
						<?php esc_html_e( 'plugins for real admin work.', 'titanium-mail-smtp' ); ?>
					</h2>
					<p><?php esc_html_e( 'Focused Free tools with clean workflows, plus practical Pro upgrades for serious websites.', 'titanium-mail-smtp' ); ?></p>
				</div>

				<div class="titanium-mm-more-plugins-hero-seal" aria-hidden="true">
					<span class="titanium-mm-more-plugins-plug-mark"><i></i></span>
					<strong>Next Gen</strong>
					<small>AdminPlugins</small>
				</div>
			</header>

			<div class="titanium-mm-more-plugins-grid">
				<?php foreach ( $plugins as $plugin ) : ?>
					<article class="titanium-mm-more-plugin-card titanium-mm-more-plugin-card--<?php echo esc_attr( sanitize_html_class( $plugin['accent'] ) ); ?>">
						<header class="titanium-mm-more-plugin-header">
							<div class="titanium-mm-more-plugin-icon" aria-hidden="true">
								<img
									src="<?php echo esc_url( TMSMTP_URL . 'assets/more-plugins/' . $plugin['image'] ); ?>"
									alt=""
									loading="lazy"
									decoding="async"
								>
							</div>

							<div class="titanium-mm-more-plugin-heading">
								<span class="titanium-mm-more-plugins-kicker">
									<?php echo esc_html( $plugin['kicker'] ); ?>
								</span>
								<h3><?php echo esc_html( $plugin['title'] ); ?></h3>
							</div>
						</header>

						<p class="titanium-mm-more-plugin-description">
							<?php echo esc_html( $plugin['description'] ); ?>
						</p>

						<div class="titanium-mm-more-plugin-badges" aria-label="<?php esc_attr_e( 'Plugin highlights', 'titanium-mail-smtp' ); ?>">
							<?php foreach ( $plugin['badges'] as $badge ) : ?>
								<span><?php echo esc_html( $badge ); ?></span>
							<?php endforeach; ?>
						</div>

						<div class="titanium-mm-more-plugin-actions">
							<a
								class="titanium-mm-more-plugin-button"
								href="<?php echo esc_url( $plugin['url'] ); ?>"
								target="_blank"
								rel="noopener noreferrer"
							>
								<?php esc_html_e( 'View Plugin', 'titanium-mail-smtp' ); ?>
							</a>
						</div>
					</article>
				<?php endforeach; ?>
			</div>
		</section>
		<?php
	}

	/**
	 * Returns the four companion-plugin cards shown by Mail SMTP.
	 *
	 * @return array<int, array<string, mixed>>
	 */
	private function get_plugins() {
		return array(
			array(
				'image'       => 'advanced-user-roles.png',
				'accent'      => 'teal',
				'kicker'      => __( 'Roles, permissions and access', 'titanium-mail-smtp' ),
				'title'       => __( 'Titanium User Role Manager, Capabilities & Access Control', 'titanium-mail-smtp' ),
				'description' => __( 'Create, clone, rename and compare roles, edit capabilities visually, allow multiple roles per user and control WordPress admin and frontend access from one focused interface.', 'titanium-mail-smtp' ),
				'badges'      => array(
					__( 'Visual capability editor', 'titanium-mail-smtp' ),
					__( 'Create, clone and compare roles', 'titanium-mail-smtp' ),
					__( 'Multiple roles per user', 'titanium-mail-smtp' ),
					__( 'Admin menu restrictions', 'titanium-mail-smtp' ),
					__( 'Frontend content control', 'titanium-mail-smtp' ),
					__( 'Role backups and restore', 'titanium-mail-smtp' ),
				),
				'url'         => 'https://wordpress.org/plugins/titanium-advanced-user-roles/',
			),
			array(
				'image'       => 'titanium-secure-downloads.png',
				'accent'      => 'cyan',
				'kicker'      => __( 'Protected files and links', 'titanium-mail-smtp' ),
				'title'       => __( 'Titanium Secure Downloads & Link Redirects', 'titanium-mail-smtp' ),
				'description' => __( 'Create controlled download and redirect items with protected links, flexible access tools, professional buttons and detailed usage visibility.', 'titanium-mail-smtp' ),
				'badges'      => array(
					__( 'Protected download links', 'titanium-mail-smtp' ),
					__( 'Password access', 'titanium-mail-smtp' ),
					__( 'Download limits and expiry', 'titanium-mail-smtp' ),
					__( 'Detailed download logs', 'titanium-mail-smtp' ),
					__( 'Files and redirects', 'titanium-mail-smtp' ),
					__( 'Elementor Wrapper Link', 'titanium-mail-smtp' ),
				),
				'url'         => 'https://wordpress.org/plugins/titanium-secure-downloads/',
			),
			array(
				'image'       => 'advanced-menu-rules.png',
				'accent'      => 'violet',
				'kicker'      => __( 'Smart menu visibility', 'titanium-mail-smtp' ),
				'title'       => __( 'Titanium Nav Menu Roles & Visibility Rules', 'titanium-mail-smtp' ),
				'description' => __( 'Turn normal WordPress menus into smart navigation with server-side visibility rules for visitors, roles, pages, posts and membership workflows.', 'titanium-mail-smtp' ),
				'badges'      => array(
					__( 'Logged-in / logged-out rules', 'titanium-mail-smtp' ),
					__( 'WordPress role targeting', 'titanium-mail-smtp' ),
					__( 'Page and post targeting', 'titanium-mail-smtp' ),
					__( 'Server-side filtering', 'titanium-mail-smtp' ),
					__( 'Membership plugin rules', 'titanium-mail-smtp' ),
					__( 'Linked page protection', 'titanium-mail-smtp' ),
				),
				'url'         => 'https://wordpress.org/plugins/titanium-advanced-menu-rules/',
			),
			array(
				'image'       => 'titanium-webp-optimizer.png',
				'accent'      => 'purple',
				'kicker'      => __( 'Modern image optimization', 'titanium-mail-smtp' ),
				'title'       => __( 'Titanium Unlimited WebP Optimizer', 'titanium-mail-smtp' ),
				'description' => __( 'Convert new and existing WordPress images to WebP without image limits, keep original files safe, optimize in bulk and track conversion results and storage savings from one clean interface.', 'titanium-mail-smtp' ),
				'badges'      => array(
					__( 'Automatic upload conversion', 'titanium-mail-smtp' ),
					__( 'Unlimited bulk optimizer', 'titanium-mail-smtp' ),
					__( 'Original file protection', 'titanium-mail-smtp' ),
					__( 'WebP delivery', 'titanium-mail-smtp' ),
					__( 'Storage savings', 'titanium-mail-smtp' ),
					__( 'AVIF tools in Pro', 'titanium-mail-smtp' ),
				),
				'url'         => 'https://wordpress.org/plugins/titanium-webp-optimizer/',
			),
		);
	}
}
