<?php

namespace Planaday\Config\OptionGroups;

use Planaday\Config\OptionTypes\Option;

/**
 * @template T as Option
 */
class OptionCluster {

	/** @var string */
	protected $name;

	/** @var string */
	protected $description;

	/** @var array<string, T> */
	protected $layout;

	/**
	 * @param string $name
	 * @param string $description
	 * @param array<string, T> $layout
	 */
	public function __construct(string $name, string $description, array $layout) {
		$this->name = $name;
		$this->description = $description;
		$this->layout = $layout;
	}

	public function getType(): string {
		foreach ( $this->layout as $item ) {
			return $item->getType();
		}

		return 'null';
	}

	/**
	 * @return array<string, T>
	 */
	public function getLayout(): array {
		return $this->layout;
	}

	/**
	 * @return string
	 */
	public function getName(): string {
		return $this->name;
	}

	/**
	 * @return string
	 */
	public function getDescription(): string {
		return $this->description;
	}
}