import { GET, POST, PUT, DELETE } from "./http";
import type { AudioTaskBaseRes, AudioTaskRes, CreateAudioTaskReq, TaskReq, DelAudioTaskReq } from "../types/audiotask";

/**
 * 获取文件列表
 * @returns 文件列表
 */
export async function GetAudioTask(data: TaskReq) {
  return await GET<AudioTaskRes>(`/audiotask`, data);
}

/**
 * 创建
 * @param data 创建参数
 */
export async function CreateAudioTask(data: CreateAudioTaskReq) {
  return await POST<AudioTaskBaseRes>(`/audiotask`, data);
}


/**
 * 取消
 * @param id ID
 */
export async function GetAudioTaskCancel(id: number) {
  return await GET<AudioTaskBaseRes>(`/audiotask/cancel/${id}`);
}


/**
 * 删除
 * @param id ID
 */
export async function DeleteAudioTask(id: number) {
  return await DELETE<AudioTaskBaseRes>(`/audiotask/${id}`);
}

/**
 * 批量删除
 * @param ids ID
 */
export async function DeleteAudioTaskAll(data: DelAudioTaskReq) {
  return await DELETE<AudioTaskBaseRes>(`/audiotask`, data);
}
