<?php

declare(strict_types=1);

namespace App\Exceptions\Pouzivatel;

use Exception;
use Throwable;
use Illuminate\Contracts\Auth\Authenticatable;

/**
 * Class PouzivatelJeBlokovany
 *
 * @package App\Exceptions\pouzivatel
 */
final class PouzivatelJeBlokovany extends Exception
{
    /**
     * @var string|null
     */
    protected $redirectTo;

    /**
     * PouzivatelJeBlokovany constructor.
     *
     * @param \Illuminate\Contracts\Auth\Authenticatable $pouzivatel
     * @param string|null                                $redirectTo
     */
    public function __construct(Authenticatable $pouzivatel, ?string $redirectTo = null)
    {
        parent::__construct(sprintf('Používateľ %s je blokovaný.', $pouzivatel->cele_meno));

        $this->redirectTo = $redirectTo;
    }

    /**
     * @return string|null
     */
    public function redirectTo()
    {
        return $this->redirectTo;
    }
}
