import api from "@shared/api"

interface IUseSubmitTranscriptionParams {
	onSuccess?: (data: { job_id: string }) => void
	onError?: (error: unknown) => void
}

export const useSubmitTranscription = ({
	onSuccess,
	onError,
}: IUseSubmitTranscriptionParams = {}) => {
	return api.useMutation(
		"post",
		"/api/tasks/transcription-generate/",
		{
			onSuccess: (data) => {
				onSuccess?.(data)
			},
			onError: (error) => {
				onError?.(error)
			},
		},
	)
}
