<?php

declare(strict_types=1);

namespace Seka\Vzdelavanie\View\Components;

use Illuminate\View\Component;

/**
 * Class Badge
 *
 * @package Seka\Vzdelavanie\View\Components
 */
class Badge extends Component
{
    /**
     * @var ?string
     */
    public $type;

    /**
     * @var ?string
     */
    public $text;

    /**
     * @var ?string
     */
    public $color;

    /**
     * Badge constructor.
     *
     * @param ?string $type
     * @param ?string $text
     * @param ?string $color
     */
    public function __construct($type = null, $text = null, $color = null)
    {
        $this->type = $type ? 'badge-' . $type : null;
        $this->text = $text ? mb_strtoupper($text) : null;
        $this->color = $color ? 'background-color: ' . $color : null;
    }

    /**
     * @return \Closure|\Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed|string
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
     */
    public function render()
    {
        return view('Vzdelavanie::components.badge.badge');
    }
}
