// 我的音色库&形象库
import {
  bluebookAiAgent,
} from '@/xiaolanbenlib/api/index'
import request from '@/xiaolanbenlib/module/axios.js'

import { TGetMyVoicesParams, TVoiceCloneResponse } from '@/types/voice'

// 克隆一个新的音色
export const cloneVoice = (data: {
  sourceUrl: string // 源语音地址 ,
  voiceText?: string // 录音文案
  entId: number|string // 企业ID
}) => {
  return request.post<TVoiceCloneResponse>(`${bluebookAiAgent}api/v1/my/voice/clone`, data)
}

// 删除指定克隆的音色
export const deleteVoice = (voiceId: string)=> {
  return request.delete(`${bluebookAiAgent}api/v1/my/voice/${voiceId}`)
}

// 获取指定克隆的音色记录--用于状态轮询
export const getVoiceStatus = (taskId: string) => {
  return request.get<TVoiceCloneResponse>(`${bluebookAiAgent}api/v1/my/voice/${taskId}/status`)
}

// 获取个人录音音色库
export const getVoices = (data:TGetMyVoicesParams) => {
  return request.get(`${bluebookAiAgent}api/v1/my/voices/`, {
    params: data
  })
}