import { requestClient } from '#/api/request';

/** AI API Key 管理 API */
const prefix = 'ai-api-key/';

export async function getAiApiKeyList(data: any) {
  return requestClient.get<any>(`${prefix}list`, { params: data });
}

export async function getAiApiKeyDetail(id: number) {
  return requestClient.get<any>(`${prefix}detail`, { params: { id } });
}

export async function getAiApiKeyOption(data?: { platform_id?: number }) {
  return requestClient.get<any>(`${prefix}option`, { params: data || {} });
}

export async function createAiApiKey(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}create`, data);
}

export async function updateAiApiKey(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}update`, data);
}

export async function deleteAiApiKey(data: Record<string, any>) {
  return requestClient.post<any>(`${prefix}delete`, data);
}

/** 设为平台默认密钥 */
export async function setAiApiKeyDefault(data: { id: number }) {
  return requestClient.post<any>(`${prefix}set-default`, data);
}
