<?php

declare(strict_types=1);

namespace App\View\Components;

use Illuminate\View\Component;

/**
 * Class Badge
 */
class Badge extends Component
{
    public ?string $type;

    public ?string $text;

    public ?string $color;

    /**
     * Badge Constructor
     */
    public function __construct(?string $type = null, ?string $text = null, ?string $color = null)
    {
        $this->type = $type ? sprintf('badge-%s', $type) : '';
        $this->color = $color ? sprintf('background-color:%s;', $color) : '';
        $this->text = $text ? mb_strtoupper($text) : '';
    }

    /**
     * @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('components.badge.badge');
    }
}
