<?php

namespace App\Http\Controllers;

use App\Models\CompanySetting;
use App\Models\Quotation;
use Illuminate\View\View;

class PublicQuotationController extends Controller
{
    /**
     * Customer-facing quotation view (share link).
     */
    public function show(string $token): View
    {
        $quotation = Quotation::where('public_token', $token)
            ->with(['customer', 'items'])
            ->firstOrFail();

        $companySettings = CompanySetting::getSettings();

        return view('quotation.public-view', [
            'quotation' => $quotation,
            'companySettings' => $companySettings,
        ]);
    }
}
