<?php

namespace Planaday\Entities\Booking\DTO;

/** @template T */
class ExtraField {
	protected string $name = '';
	protected string $type = '';
	protected bool $isRequired = false;
	protected string $description = '';
	/** @var T|T[] */
	protected mixed $defaultValue = null;
	/** @var T[] */
	protected array $options = [];

	public function __construct(
		protected int $id
	) {}

	public function setName( string $name ): self {
		$this->name = $name;

		return $this;
	}

	public function setType( string $type ): self {
		$this->type = $type;

		return $this;
	}

	public function setIsRequired( bool $isRequired ): self {
		$this->isRequired = $isRequired;

		return $this;
	}

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

		return $this;
	}

	/**
	 * @param T|T[] $defaultValue
	 *
	 * @return $this
	 */
	public function setDefaultValue( mixed $defaultValue ): self {
		$this->defaultValue = $defaultValue;

		return $this;
	}

	/**
	 * @param T[] $options
	 *
	 * @return $this
	 */
	public function setOptions( array $options ): self {
		$this->options = $options;

		return $this;
	}

	public function getId(): int {
		return $this->id;
	}

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

	public function getType(): string {
		return $this->type;
	}

	public function isRequired(): bool {
		return $this->isRequired;
	}

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

	/**
	 * @return T|T[]
	 */
	public function getDefaultValue() {
		return $this->defaultValue;
	}

	/**
	 * @return T[]
	 */
	public function getOptions(): array {
		return $this->options;
	}
}