import { useCallback } from "react"; import { useHttpService } from "../services/HttpService.tsx"; import { environment } from "../environments/environment.ts"; import type { ArchiveReason } from "../utils/archivedResource"; import type { SaveTransport } from "../utils/saveOperation"; /** Withdraw an order through the base API and preserve the server's refusal message. */ export const useWithdrawDiagnosticOrder = () => { const { put } = useHttpService(); return useCallback( async ( orderId: string, reason: ArchiveReason, note?: string, transport?: SaveTransport, ): Promise<{ orderId?: string; status?: string }> => put(`${environment.fhirBaseApi}/diagnostic-order/${orderId}/revoke`, { reason, note }, transport), [put], ); };