<?php

namespace Planaday\Utility\FormBuilder\LayoutItems;

use Planaday\Utility\FormBuilder\LayoutItem;

class Text implements LayoutItem {
	use BasicLayoutItem;

	protected array $classes = [];

	public function __construct(
		protected string $text
	) {}

	public function addClasses(string ...$classes): self {
		$this->classes = array_merge($this->classes, $classes);
		return $this;
	}

	public function getText(): string {
		return $this->text;
	}

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