<?php
/**
 * Inline Theme 3 - Featured.
 *
 * @package Relatedly\Theming\Inline
 * @since   2.0.0
 */

namespace Relatedly\Theming\Inline;

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

/**
 * Renders the featured inline theme.
 *
 * @since 2.0.0
 */
class Theme3Featured extends AbstractTheme {
	/**
	 * Template file name.
	 *
	 * @var string
	 */
	protected string $template_file = 'inline/featured.php';

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

	/**
	 * 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'            => 'inline_theme3_bg',
				'--relatedly-border'        => 'inline_theme3_border_color',
				'--relatedly-title-color'   => 'inline_theme3_title_color',
				'--relatedly-title-size'    => 'inline_theme3_title_size',
				'--relatedly-title-weight'  => 'inline_theme3_title_weight',
				'--relatedly-label-color'   => 'inline_theme3_label_color',
				'--relatedly-label-size'    => 'inline_theme3_label_size',
				'--relatedly-label-weight'  => 'inline_theme3_label_weight',
				'--relatedly-excerpt-color' => 'inline_theme3_excerpt_color',
			]
		);
		$vars['show_excerpt']        = (bool) $this->options->get( 'inline_theme3_show_excerpt', true );
		$vars['thumbnail_size']      = (string) $this->options->get( 'inline_theme3_thumbnail_size', 'thumbnail' );
		$vars['thumbnail_alignment'] = (string) $this->options->get( 'inline_theme3_thumbnail_alignment', 'left' );
		return $vars;
	}
}
