export function trucksForSite(trucks: T[], siteId: string): T[] { if (!siteId) return trucks return trucks.filter(t => t.site_id === null || t.site_id === siteId) } export function siteForTruck( trucks: { id: string; site_id: string | null }[], truckId: string | null | undefined, ): string | null { if (!truckId) return null return trucks.find(t => t.id === truckId)?.site_id ?? null }