<?php
/**
 * Magazine hero — featured + trending + latest.
 *
 * @package Kutby
 * @since   2.8.0
 */

declare(strict_types=1);

namespace Kutby\Hero\Layouts;

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

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

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

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

	/**
	 * {@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' => 'magazine' ) );
		?>
		<div class="kutby-hero__magazine">
			<div class="kutby-hero__magazine-featured">
				<?php FeaturedArticle::render( $ctx ); ?>
			</div>
			<aside class="kutby-hero__magazine-aside">
				<?php TrendingList::render( $ctx, array( 'limit' => 5 ) ); ?>
				<?php LatestPosts::render( $ctx, array( 'limit' => 5 ) ); ?>
			</aside>
		</div>
		<?php
		HeroSection::close();
	}
}
