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

namespace Relatedly\Theming\Inline;

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

/**
 * Renders the simple inline theme.
 *
 * @since 2.0.0
 */
class Theme1Simple extends AbstractTheme {
	/**
	 * Template file name.
	 *
	 * @var string
	 */
	protected string $template_file = 'inline/simple.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_theme1_bg',
				'--relatedly-border'        => 'inline_theme1_border_color',
				'--relatedly-title-color'   => 'inline_theme1_title_color',
				'--relatedly-title-size'    => 'inline_theme1_title_size',
				'--relatedly-title-weight'  => 'inline_theme1_title_weight',
				'--relatedly-label-color'   => 'inline_theme1_label_color',
				'--relatedly-label-size'    => 'inline_theme1_label_size',
				'--relatedly-label-weight'  => 'inline_theme1_label_weight',
				'--relatedly-excerpt-color' => 'inline_theme1_excerpt_color',
				'--relatedly-excerpt-size'  => 'inline_theme1_excerpt_size',
			]
		);
		$vars['show_excerpt'] = (bool) $this->options->get( 'inline_theme1_show_excerpt', true );
		return $vars;
	}
}
