import request from '/@/utils/request';
import { AxiosPromise } from 'axios';
import type { ListByClassCodeParams, ListByClassCodeReponse, ListAllFeeItem } from './type';

export function Add(params: object) {
	return request({
		url: '/lis/class/info/add',
		method: 'post',
		data: params,
	});
}
export function deleteId(params: string) {
	return request({
		url: '/lis/class/info/delete',
		method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		data: params,
	});
}

/**
 * 获取检验分类项目对照已收费/未收费数据，其中未收费数据已废弃
 * @param params 
 * @returns 
 */
export function listByClassCode(params: ListByClassCodeParams): AxiosPromise<ListByClassCodeReponse> {
    return request({
      url: 'lis/feeitem/vs/class/listByClassCode',
      method: 'post',
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      params
    })
}

/**
 * 修改检验分类项目对照
 * @param params 
 * @returns 
 */
export function update(params: object) {
    return request({
      url: '/lis/feeitem/vs/class/update',
      method: 'post',
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      params: params
    })
}


/**
 * 返回收费项目列表
 * @param clientCode 
 * @returns 
 */
export function listAllFeeItemsApi(clientCode: string) : AxiosPromise<ListAllFeeItem[]> {
  return request({
    url: '/lis/feeitem/info/listAllFeeItems',
    method: 'post',
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
    },
    params: { clientCode }
  })
}