package com.sonic.cow.service;

import com.mashape.unirest.http.exceptions.UnirestException;
import com.sonic.cow.domain.input.GenerateRtcTokenInput;
import com.sonic.cow.domain.input.VoiceAsrInput;
import com.sonic.cow.domain.input.VoiceChatOptInput;
import com.sonic.cow.domain.input.VoiceTtsV2Input;
import com.sonic.cow.domain.output.AsrOutput;
import com.sonic.cow.domain.output.GenerateRtcTokenOutput;
import com.sonic.cow.domain.output.VoiceChatOptOutput;
import org.apache.ibatis.annotations.Param;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @description: 语音通话
 * @author: mzc
 * @date: 2025-07-30 11:12
 **/
public interface VoiceService {

    /**
     * 语音识别
     *
     * @param userId 用户ID
     * @param input  base64编码音频内容
     * @return
     */
    AsrOutput asr(Long userId, VoiceAsrInput input) throws UnirestException, InterruptedException;

    /**
     * 语音生成
     *
     * @param userId
     * @param input
     * @return
     */
    String tts(Long userId, VoiceTtsV2Input input);

    /**
     * 语音扣费
     * @param userId
     * @param aiId
     */
    void ttsDeAmount(Long userId, Long aiId);

    /**
     * 检测余额是否不足
     *
     * @param userId
     * @param amount 本次金额
     * @return
     */
    boolean checkBalanceIsInsufficient(Long userId, Long amount);
}
