<?php

namespace App\View\Components\Admin;

use Illuminate\View\Component;

class NavItem extends Component
{
    public function __construct(
        public string $route,
        public string $icon,
        public string $label,
        public ?string $badge = null,
    ) {}

    public function isActive(): bool
    {
        return request()->routeIs($this->route)
            || request()->routeIs($this->route . '.*');
    }

    public function render()
    {
        return view('components.admin.nav-item');
    }
}
