<?php
/**
 * Grid hero — uniform article grid.
 *
 * @package Kutby
 * @since   2.8.0
 */

declare(strict_types=1);

namespace Kutby\Hero\Layouts;

use Kutby\Hero\Components\HeroGrid;
use Kutby\Hero\Components\HeroSection;
use Kutby\Hero\Contracts\HeroLayoutInterface;
use Kutby\Hero\Support\HeroContext;

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

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

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

	/**
	 * {@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',
			'overlay',
			'image_ratio',
			'spacing',
			'container_width',
		);
	}

	/**
	 * {@inheritdoc}
	 */
	public function render( HeroContext $ctx ): void {
		HeroSection::open( $ctx, array( 'layout' => 'grid' ) );
		HeroGrid::render( $ctx );
		HeroSection::close();
	}
}
