<?php

namespace Planaday\Config\OptionTypes;

/**
 * @template TDefault
 * @extends Option<bool, TDefault>
 */
class BoolOption extends Option {
	/**
	 * @param string $index
	 * @param string $title
	 * @param string $description
	 * @param null|bool $value
	 * @param TDefault $defaultValue
	 */
	public function __construct( string $index, string $title, string $description, ?bool $value, $defaultValue ) {
		parent::__construct( $index, $title, $description, $value, $defaultValue );
	}

	function getType(): string {
		return 'bool';
	}

	function is(bool $test = true):bool {
		return $this->getValue() === $test;
	}
}