<?php
/**
 * Classic hero — featured + 4 secondary cards.
 *
 * @package Kutby
 * @since   2.8.0
 */

declare(strict_types=1);

namespace Kutby\Hero\Layouts;

use Kutby\Hero\Components\ArticleCard;
use Kutby\Hero\Components\FeaturedArticle;
use Kutby\Hero\Components\HeroSection;
use Kutby\Hero\Contracts\HeroLayoutInterface;
use Kutby\Hero\Support\HeroContext;

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

/**
 * Class ClassicHero
 */
final class ClassicHero implements HeroLayoutInterface {

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

	/**
	 * {@inheritdoc}
	 */
	public function label(): string {
		return 'كلاسيكي';
	}

	/**
	 * {@inheritdoc}
	 */
	public function option_keys(): array {
		return array(
			'posts_count',
			'featured_source',
			'category',
			'tag',
			'manual_ids',
			'show_meta',
			'show_category',
			'show_author',
			'show_date',
			'show_excerpt',
			'overlay',
			'image_ratio',
			'spacing',
			'container_width',
		);
	}

	/**
	 * {@inheritdoc}
	 */
	public function render( HeroContext $ctx ): void {
		HeroSection::open( $ctx, array( 'layout' => 'classic' ) );
		?>
		<div class="kutby-hero__classic">
			<div class="kutby-hero__classic-featured">
				<?php FeaturedArticle::render( $ctx ); ?>
			</div>
			<div class="kutby-hero__classic-secondary">
				<?php
				foreach ( $ctx->secondary( 4 ) as $post ) {
					ArticleCard::render( $ctx, array( 'post' => $post ) );
				}
				?>
			</div>
		</div>
		<?php
		HeroSection::close();
	}
}
