<?php

namespace App\View\Components\Layout;

use App\Repositories\Catalog\CategoryRepository;
use App\Repositories\Catalog\GenderRepository;
use App\Repositories\Catalog\BrandRepository;

use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;

class NavbarCategory extends Component
{

    public $genders = [];
    public $categories = [];
    public $brands = [];
    /**
     * Create a new component instance.
     */
    public function __construct()
    {
        //

        $genderRepository = new GenderRepository();
        $categoryRepository = new CategoryRepository();
        $brandsRepository = new BrandRepository();


        $this->genders = $genderRepository->getList([]);
           $this->genders = collect($this->genders)->chunk(7);

        $this->categories = $categoryRepository->getList([]);
        // chunk
        $this->categories = collect($this->categories)->chunk(7);
        
        $this->brands = $brandsRepository->getList([]);
         $this->brands = collect($this->brands)->chunk(7);
    }

    /**
     * Get the view / contents that represent the component.
     */
    public function render(): View|Closure|string
    {
        return view('components.layout.navbar-category');
    }
}
