import { defHttp } from '/@/utils/http/axios';
import {
  GetDepartmentListModel,
  DeleteBatchesParams,
  DepartmentIdParams,
  AddDepartmentParams,
  EditDepartmentParams,
  GetDepartmentModel,
} from './model/departmentModel';

enum Api {
  DepartmentUrl = '/department/',
}

/**
 * @description: GetDepartmentList
 */
export function getDepartmentList(params) {
  console.log('-------------------getDepartmentList---------------');
  return defHttp.request<GetDepartmentListModel>({
    url: Api.DepartmentUrl,
    method: 'GET',
    params,
  });
}

/**
 * @description: addDepartment
 */
export function addDepartment(params: AddDepartmentParams) {
  return defHttp.request<GetDepartmentListModel>({
    url: Api.DepartmentUrl,
    method: 'POST',
    params,
  });
}
/**
 * @description: 批量删除交易类型
 */
export function deleteBatchesDepartment(params: DeleteBatchesParams) {
  return defHttp.request<GetDepartmentListModel>({
    url: Api.DepartmentUrl,
    method: 'DELETE',
    params,
  });
}

/**
 * @description: 获取单个交易类型
 */
export function getDepartment(params: DepartmentIdParams) {
  return defHttp.request<GetDepartmentModel>({
    url: Api.DepartmentUrl + '/' + params.id,
    method: 'GET',
  });
}
/**
 * @description: 修改单个交易类型
 */
export function editDepartment(params: EditDepartmentParams) {
  return defHttp.request<GetDepartmentListModel>({
    url: Api.DepartmentUrl + '/' + params.id,
    method: 'PUT',
    params,
  });
}
/**
 * @description: 删除单个交易类型
 */
export function deleteDepartment(params: DepartmentIdParams) {
  return defHttp.request<GetDepartmentListModel>({
    url: Api.DepartmentUrl + '/' + params.id,
    method: 'DELETE',
  });
}
