"use client"

import { useCallback } from "react"
import { useMailRouteRoot } from "@/lib/demo/demo-mail-context"
import {
  buildSearchUrl,
  type SearchParams,
} from "@/lib/mail-search/search-params"

export function useBuildSearchUrl() {
  const routeRoot = useMailRouteRoot()
  return useCallback(
    (params: Partial<SearchParams>) => buildSearchUrl(params, routeRoot),
    [routeRoot]
  )
}
