import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TokenUsageVO, TokenUsageForm, TokenUsageQuery } from '@/api/ai/tokenUsage/types';

/**
 * 查询用户token使用详情列表
 * @param query
 * @returns {*}
 */

export const listTokenUsage = (query?: TokenUsageQuery): AxiosPromise<TokenUsageVO[]> => {
  return request({
    url: '/ai/tokenUsage/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户token使用详情详细
 * @param tokenUsageId
 */
export const getTokenUsage = (tokenUsageId: string | number): AxiosPromise<TokenUsageVO> => {
  return request({
    url: '/ai/tokenUsage/' + tokenUsageId,
    method: 'get'
  });
};

/**
 * 新增用户token使用详情
 * @param data
 */
export const addTokenUsage = (data: TokenUsageForm) => {
  return request({
    url: '/ai/tokenUsage',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户token使用详情
 * @param data
 */
export const updateTokenUsage = (data: TokenUsageForm) => {
  return request({
    url: '/ai/tokenUsage',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户token使用详情
 * @param tokenUsageId
 */
export const delTokenUsage = (tokenUsageId: string | number | Array<string | number>) => {
  return request({
    url: '/ai/tokenUsage/' + tokenUsageId,
    method: 'delete'
  });
};


/**
 * 下拉框查询用户token使用详情列表
 * @param query
 * @returns {*}
 */
export function getAiTokenUsageList (query) {
    return request({
        url: '/ai/tokenUsage/getAiTokenUsageList',
        method: 'get',
        params: query
    });
};


/**
 * 获取AI会话详情
 * @param query
 * @returns {*}
 */
export function getAiChatMessageDetailList (query) {
  return request({
    url: '/ai/aiChatMessage/listDetail',
    method: 'get',
    params: query
  });
};
