<?php

namespace App\Http\View\Composers;

use App\Models\Tour\TourCategory;
use Illuminate\View\View;

class AgencyHeaderComposer
{
    public function compose(View $view)
    {
        // View'da agency varsa kategorileri ve product type'ları yükle
        if ($view->getData()['agency'] ?? null) {
            $agency = $view->getData()['agency'];

            // Acentenin aktif product type'ları
            $productTypes = $agency->productTypes()
                ->where('agency_product_types.is_active', true)
                ->where('product_types.is_active', true)
                ->orderBy('product_types.sort_order')
                ->get();

            $view->with('productTypes', $productTypes);
        }
    }
}
