<?php
/**
 * Horizontal card — image start, content end.
 *
 * @package Kutby
 * @since   2.9.0
 */

declare(strict_types=1);

namespace Kutby\Cards\Variants;

use Kutby\Cards\Contracts\CardVariantInterface;
use Kutby\Cards\Parts\CategoryBadge;
use Kutby\Cards\Parts\Excerpt;
use Kutby\Cards\Parts\Meta;
use Kutby\Cards\Parts\Thumbnail;
use Kutby\Cards\Parts\Title;
use Kutby\Cards\Support\CardContext;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Class HorizontalCard
 */
final class HorizontalCard implements CardVariantInterface {

	/**
	 * {@inheritdoc}
	 */
	public static function id(): string {
		return 'horizontal';
	}

	/**
	 * {@inheritdoc}
	 */
	public static function render( CardContext $ctx ): void {
		$classes = trim( 'kutby-card kutby-card--horizontal ' . $ctx->extra_class() );
		?>
		<article <?php post_class( $classes, $ctx->post() ); ?>>
			<?php
			Thumbnail::render(
				$ctx,
				array(
					'size' => 'medium',
					'lazy' => true,
				)
			);
			?>
			<div class="kutby-card__body">
				<?php CategoryBadge::render( $ctx ); ?>
				<?php Title::render( $ctx ); ?>
				<?php Meta::render( $ctx ); ?>
				<?php Excerpt::render( $ctx ); ?>
			</div>
		</article>
		<?php
	}
}
