import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ErpClientVO, ErpClientQuery } from './types';

/**
 * 查询ERP客户列表（分页）
 * @param query
 * @Author: Antigravity
 */
export const listErpClient = (query?: ErpClientQuery): AxiosPromise<ErpClientVO[]> => {
  return request({
    url: '/erp/client/list',
    method: 'get',
    params: query
  });
};

/**
 * 根据名称模糊检索客户（全量，不分页）
 * @Author: Trae
 */
export const searchErpClient = (name: string): AxiosPromise<ErpClientVO[]> => {
  return request({
    url: '/erp/client/search',
    method: 'get',
    params: { name }
  });
};

/**
 * 根据 RowID 列表批量查询客户
 * @param rowIds 逗号分隔的 rowId 字符串
 */
export const getErpClientByIds = (rowIds: string): AxiosPromise<ErpClientVO[]> => {
  return request({
    url: '/erp/client/listByIds',
    method: 'get',
    params: { rowIds }
  });
};
