<?php
/**
 * End-content Theme 6 - Compact.
 *
 * @package Relatedly\Theming\EndContent
 * @since   2.0.0
 */

namespace Relatedly\Theming\EndContent;

use Relatedly\Theming\AbstractTheme;
defined( 'ABSPATH' ) || exit;

/**
 * Renders the compact end-content theme.
 *
 * @since 2.0.0
 */
class Theme6Compact extends AbstractTheme {
	/**
	 * Template file name.
	 *
	 * @var string
	 */
	protected string $template_file = 'end-content/compact.php';

	/**
	 * Get the tracking display type.
	 *
	 * @return string
	 */
	protected function display_type(): string {
		return 'end_content'; }

	/**
	 * Get the end-content label.
	 *
	 * @return string
	 */
	protected function get_label(): string {
		return $this->labels->random_end_content(); }

	/**
	 * Build template variables.
	 *
	 * @param \WP_Post $post      Post object.
	 * @param int|null $source_id Source post ID.
	 * @return array<string,mixed>
	 */
	protected function template_vars( \WP_Post $post, ?int $source_id ): array {
		$vars             = parent::template_vars( $post, $source_id );
		$vars['css_vars'] = $this->css_vars(
			[
				'--relatedly-bg'          => 'end_theme6_bg',
				'--relatedly-title-color' => 'end_theme6_title_color',
				'--relatedly-title-size'  => 'end_theme6_title_size',
				'--relatedly-label-color' => 'end_theme6_label_color',
				'--relatedly-label-size'  => 'end_theme6_label_size',
				'--relatedly-meta-color'  => 'end_theme6_meta_color',
			]
		);
		return $vars;
	}
}
