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

const prefix = 'log/';

export type ApiLogUserSearchItem = {
  id: number;
  name: string;
  avatar: string;
  role_label: string;
  user_type: 'admin' | 'patient' | 'doctor';
  platform_type: 0 | 1 | 2;
};

/**
 * 分页查询 Api 访问日志
 */
export async function getOldApiLogList(data: any) {
  return requestClient.get<any>(`${prefix}api-list`, { params: data });
}

/**
 * Api 访问日志操作用户搜索
 */
export async function searchApiLogUsers(params: {
  user_type: 'admin' | 'patient' | 'doctor';
  keyword: string;
  pageSize?: number;
}) {
  return requestClient.get<{ items: ApiLogUserSearchItem[] }>(
    `${prefix}user-search`,
    { params },
  );
}
