<?php

namespace Planaday\Utility\FormBuilder\InputFields;

use Planaday\Utility\FormBuilder\DataTypes\StringType;
use Planaday\Utility\FormBuilder\InputField;

/**
 * @uses BasicInputField<string>
 * @implements InputField<string>
 */
class StringInput implements InputField {
	use BasicInputField;

	protected string $placeholder = '';

	public function __construct(StringType $type = new StringType()) {
		$this->dataType = $type;
	}

	public function setPlaceholder( string $placeholder ): self {
		$this->placeholder = $placeholder;
		return $this;
	}

	public function getImplJson(): array {
		return [
			"type" => 'string',
			"placeholder" => $this->placeholder
		];
	}
}