<?php

namespace Planaday\Utility\FormBuilder\Structures;

class CollapsibleGroup extends BasicGroup {
	protected bool $startCollapsed = false;

	protected ?string $header = null;
	protected ?string $description = null;

	public function startCollapsed(): self {
		$this->startCollapsed = true;
		return $this;
	}

	public function setHeader( ?string $header ): self {
		$this->header = $header;
		return $this;
	}

	public function setDescription( ?string $description ): self {
		$this->description = $description;
		return $this;
	}

	public function getImplJson(): array {
		return [
			"type" => 'collapsible',
			"startCollapsed" => $this->startCollapsed,
			"header" => $this->header,
			"description" => $this->description,
		];
	}
}