import { useZocksStore } from '../../app'
import {
  selectTranscriptionServiceIsEnabled,
  selectParticipantTranscripts,
  selectTranscriptionServiceIsLoading,
} from './transcriptSlice'

export const useTranscript = (participantId: string) => {
  const transcriptionServiceIsEnabled = useZocksStore(selectTranscriptionServiceIsEnabled)
  const transcriptionServiceIsLoading = useZocksStore(selectTranscriptionServiceIsLoading)

  const { partialTranscript, finalTranscripts } = useZocksStore((state) =>
    selectParticipantTranscripts(state, participantId)
  )

  return { transcriptionServiceIsEnabled, transcriptionServiceIsLoading, partialTranscript, finalTranscripts }
}
