<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Models\Bill;

class PublicWaybillController extends Controller
{
    public function show(string $trackingCode)
    {
        $bill = Bill::with(['transportLoad', 'cargoItems'])->where('tracking_code', $trackingCode)->firstOrFail();

        return response()->json([
            'success' => true,
            'message' => 'Waybill retrieved successfully',
            'data' => $bill,
        ]);
    }
}
