<?php

namespace Plainwork\Ui\Component;

final class Link extends AbstractTag
{
    private ?string $path = null;
    private array $params = [];
    private array $label = [];
    private bool $isDanger = false;
    private bool $isMenu = false;
    private bool $disabled = false;
    private string $fullUri = '';
    private ?string $jsConfirm = null;

    public function __construct(?string $path = null, array $params = [], ...$label)
    {
        $this->path = $path;
        $this->params = $params;
        $this->label = $label;
    }

    public function withJsConfirm(string $v): self
    {
        $this->jsConfirm = $v;

        return $this;
    }

    public function getJsConfirm(): ?string
    {
        return $this->jsConfirm;
    }

    public function setFull(string $uri): self
    {
        $this->fullUri = $uri;

        return $this;
    }

    public function isFull()
    {
        return $this->fullUri;
    }

    public function getPath(): ?string
    {
        return $this->path;
    }

    public function setPath(?string $path): self
    {
        $this->path = $path;

        return $this;
    }

    public function getParams(): array
    {
        return $this->params;
    }

    public function setLabel($label): self
    {
        $this->label = [$label];

        return $this;
    }

    public function getLabel(): array
    {
        return $this->label;
    }

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

    public function setDanger(bool $isDanger = true): self
    {
        $this->isDanger = $isDanger;

        return $this;
    }

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

    public function setMenu(bool $on = true): self
    {
        $this->isMenu = $on;

        return $this;
    }

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

    public function disable(): self
    {
        $this->disabled = true;

        return $this;
    }
}
