import { ApiClient } from '@/lib/apiClient';

import refineAlignedLyrics from '../lyrics/refineAlignedLyrics';
import { getAlignedLyricsWithFallback } from '../queryHooks/useEditorLyricsQuery';

export default async function fetchRefinedAlignedLyrics(
  apiClient: ApiClient,
  clipId: string,
  lyrics: string,
  skipAugmentation?: boolean
) {
  return refineAlignedLyrics(
    await getAlignedLyricsWithFallback(
      apiClient,
      clipId,
      lyrics,
      !skipAugmentation
    )
  );
}
