<?php

namespace App\Modules\Inventory\Controllers;

use App\Http\Controllers\Controller;
use App\Modules\Inventory\Models\ItemCategory;
use App\Modules\Inventory\Repositories\ItemCategoryRepository;
use Illuminate\View\View;

class ItemCategoryPageController extends Controller
{
    public function __construct(
        private readonly ItemCategoryRepository $categories,
    ) {}

    public function index(): View
    {
        $this->authorize('viewAny', ItemCategory::class);

        return view('pages.inventory.categories.index', [
            'categories' => $this->categories->paginatedWithParent(),
        ]);
    }
}
