<?php
/**
 * Floating Sidebar Variant 1.
 *
 * @package     Relatedly
 * @since       2.0.0
 * @fs_premium_only
 */

namespace Relatedly\Theming\Floating\Variants;

use Relatedly\Theming\AbstractTheme;

defined( 'ABSPATH' ) || exit;

/**
 * Renders floating sidebar variant 1.
 *
 * @since 2.0.0
 */
class Variant1 extends AbstractTheme {
	/**
	 * Template file name.
	 *
	 * @var string
	 */
	protected string $template_file = 'floating/variant1.php';

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

	/**
	 * 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(
			array(
				'--relatedly-bg'            => 'floating_sidebar_variant1_bg',
				'--relatedly-border'        => 'floating_sidebar_variant1_border_color',
				'--relatedly-title-color'   => 'floating_sidebar_variant1_title_color',
				'--relatedly-title-size'    => 'floating_sidebar_variant1_title_size',
				'--relatedly-label-color'   => 'floating_sidebar_variant1_label_color',
				'--relatedly-label-size'    => 'floating_sidebar_variant1_label_size',
				'--relatedly-excerpt-color' => 'floating_sidebar_variant1_excerpt_color',
			)
		);
		return $vars;
	}
}
