<?php

namespace App\Components\Workboard;

use App\Models\WorkboardCategory;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Livewire\Attributes\Computed;
use Livewire\Component;

class WorkboardIndex extends Component
{
    use AuthorizesRequests;

    public function mount(): void
    {
        $this->authorize('workboard.view');
    }

    #[Computed]
    public function categories()
    {
        return WorkboardCategory::withCount(['availableItems'])->latest()->get();
    }

    public function render()
    {
        return view('components.workboard.workboard-index');
    }
}
