<?php
/**
 * Inline Theme 8 — Card.
 *
 * @package     Relatedly\Theming\Inline
 * @since       2.0.0
 * @fs_premium_only
 */

namespace Relatedly\Theming\Inline;

use Relatedly\Theming\AbstractTheme;

defined( 'ABSPATH' ) || exit;

/**
 * Renders the premium card inline theme.
 *
 * @since 2.0.0
 */
class Theme8Card extends AbstractTheme {
	/**
	 * Template file name.
	 *
	 * @var string
	 */
	protected string $template_file = 'inline/card.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(
			array(
				'--relatedly-bg'            => 'inline_theme8_bg',
				'--relatedly-title-color'   => 'inline_theme8_title_color',
				'--relatedly-title-size'    => 'inline_theme8_title_size',
				'--relatedly-date-color'    => 'inline_theme8_date_color',
				'--relatedly-excerpt-color' => 'inline_theme8_excerpt_color',
				'--relatedly-excerpt-size'  => 'inline_theme8_excerpt_size',
				'--relatedly-padding'       => 'inline_theme8_padding',
				'--relatedly-radius'        => 'inline_theme8_border_radius',
			)
		);
		$vars['show_excerpt'] = (bool) $this->options->get( 'inline_theme8_show_excerpt', true );
		$vars['show_date']    = (bool) $this->options->get( 'inline_theme8_show_date', true );
		$vars['date_type']    = (string) $this->options->get( 'inline_theme8_date_type', 'published' );
		return $vars;
	}
}
