import api from "@shared/api"

interface IUseSubmitSilenceDetectParams {
	onSuccess?: (data: unknown) => void
	onError?: (error: unknown) => void
}

export const useSubmitSilenceDetect = ({
	onSuccess,
	onError,
}: IUseSubmitSilenceDetectParams = {}) => {
	// NOTE: Endpoint types will be available after running `bun run gen:api-types`
	return api.useMutation(
		"post",
		"/api/tasks/silence-detect/" as "/api/tasks/silence-remove/",
		{
			onSuccess: (data) => {
				onSuccess?.(data)
			},
			onError: (error) => {
				onError?.(error)
			},
		},
	)
}
