import { defHttp } from '/@/utils/http/axios';
import {
  GetTypeListModel,
  DeleteBatchesParams,
  TypeIdParams,
  AddTypeParams,
  EditTypeParams,
  GetAccountListModel,
  GetTypeModel,
  GetAccountModel,
  AccountIdParams,
  AddAccountParams,
  EditAccountParams,
  GetAccountRecordListModel,
  GetDuesListModel,
  GetDuesModel,
  DuesIdParams,
  AddDuesParams,
  EditDuesParams,
  CopyDuesParams,
  GetBillListModel,
  GetBillModel,
  BillIdParams,
  AddBillParams,
  EditBillParams,
  GetFeeParams,
  GetFeeModel,
} from './model/moneyModel';

enum Api {
  TypeUrl = '/money/type',
  AccountUrl = '/money/account',
  DuesUrl = '/money/dues',
  BillUrl = '/money/bill',
  FeeUrl = '/money/fees',
}

/**
 * @description: GetTypeList
 */
export function getTypeList(params) {
  console.log('-------------------getTypeList---------------');
  return defHttp.request<GetTypeListModel>({
    url: Api.TypeUrl,
    method: 'GET',
    params,
  });
}

/**
 * @description: addType
 */
export function addType(params: AddTypeParams) {
  return defHttp.request<GetTypeListModel>({
    url: Api.TypeUrl,
    method: 'POST',
    params,
  });
}
/**
 * @description: 批量删除交易类型
 */
export function deleteBatchesType(params: DeleteBatchesParams) {
  return defHttp.request<GetTypeListModel>({
    url: Api.TypeUrl,
    method: 'DELETE',
    params,
  });
}

/**
 * @description: 获取单个交易类型
 */
export function getType(params: TypeIdParams) {
  return defHttp.request<GetTypeModel>({
    url: Api.TypeUrl + '/' + params.id,
    method: 'GET',
  });
}
/**
 * @description: 修改单个交易类型
 */
export function editType(params: EditTypeParams) {
  return defHttp.request<GetTypeListModel>({
    url: Api.TypeUrl + '/' + params.id,
    method: 'PUT',
    params,
  });
}
/**
 * @description: 删除单个交易类型
 */
export function deleteType(params: TypeIdParams) {
  return defHttp.request<GetTypeListModel>({
    url: Api.TypeUrl + '/' + params.id,
    method: 'DELETE',
  });
}

/**
 * @description: GetAccountList -----------------------------------------------
 */
export function getAccountList(params) {
  console.log('-------------------getAccountList---------------');
  return defHttp.request<GetAccountListModel>({
    url: Api.AccountUrl,
    method: 'GET',
    params,
  });
}

/**
 * @description: addAccount
 */
export function addAccount(params: AddAccountParams) {
  return defHttp.request<GetAccountListModel>({
    url: Api.AccountUrl,
    method: 'POST',
    params,
  });
}
/**
 * @description: 批量删除账户
 */
export function deleteBatchesAccount(params: DeleteBatchesParams) {
  return defHttp.request<GetAccountListModel>({
    url: Api.AccountUrl,
    method: 'DELETE',
    params,
  });
}

/**
 * @description: 获取单个账户
 */
export function getAccount(params: AccountIdParams) {
  return defHttp.request<GetAccountModel>({
    url: Api.AccountUrl + '/' + params.id,
    method: 'GET',
  });
}
/**
 * @description: GetAccountRecordList -----------------------------------------------
 */
export function getAccountRecordList(params) {
  return defHttp.request<GetAccountRecordListModel>({
    url: Api.AccountUrl + '/' + params.id,
    method: 'POST',
    params,
  });
}
/**
 * @description: 修改单个账户
 */
export function editAccount(params: EditAccountParams) {
  return defHttp.request<GetAccountListModel>({
    url: Api.AccountUrl + '/' + params.id,
    method: 'PUT',
    params,
  });
}
/**
 * @description: 删除单个账户
 */
export function deleteAccount(params: AccountIdParams) {
  return defHttp.request<GetAccountListModel>({
    url: Api.AccountUrl + '/' + params.id,
    method: 'DELETE',
  });
}
/**
 * @description: GetDuesList -----------------------------------------------
 */
export function getDuesList(params) {
  console.log('-------------------getDuesList---------------');
  return defHttp.request<GetDuesListModel>({
    url: Api.DuesUrl,
    method: 'GET',
    params,
  });
}

/**
 * @description: addDues
 */
export function addDues(params: AddDuesParams) {
  return defHttp.request<GetDuesListModel>({
    url: Api.DuesUrl,
    method: 'POST',
    params,
  });
}
/**
 * @description: 批量删除会费信息
 */
export function deleteBatchesDues(params: DeleteBatchesParams) {
  return defHttp.request<GetDuesListModel>({
    url: Api.DuesUrl,
    method: 'DELETE',
    params,
  });
}

/**
 * @description: 获取单条会费信息
 */
export function getDues(params: DuesIdParams) {
  return defHttp.request<GetDuesModel>({
    url: Api.DuesUrl + '/' + params.id,
    method: 'GET',
  });
}
/**
 * @description: 修改单条会费信息
 */
export function editDues(params: EditDuesParams) {
  return defHttp.request<GetDuesListModel>({
    url: Api.DuesUrl + '/' + params.id,
    method: 'PUT',
    params,
  });
}
/**
 * @description: 复制单条会费信息
 */
export function copyDues(params: CopyDuesParams) {
  return defHttp.request<GetDuesListModel>({
    url: Api.DuesUrl + '/' + params.id,
    method: 'POST',
    params,
  });
}
/**
 * @description: 删除单条会费信息
 */
export function deleteDues(params: DuesIdParams) {
  return defHttp.request<GetDuesListModel>({
    url: Api.DuesUrl + '/' + params.id,
    method: 'DELETE',
  });
}
/**
 * @description: GetBillList -----------------------------------------------
 */
export function getBillList(params) {
  console.log('-------------------getBillList---------------');
  return defHttp.request<GetBillListModel>({
    url: Api.BillUrl,
    method: 'GET',
    params,
  });
}

/**
 * @description: addBill
 */
export function addBill(params: AddBillParams) {
  return defHttp.request<GetBillListModel>({
    url: Api.BillUrl,
    method: 'POST',
    params,
  });
}

/**
 * @description: 获取单条账目信息
 */
export function getBill(params: BillIdParams) {
  return defHttp.request<GetBillModel>({
    url: Api.BillUrl + '/' + params.id,
    method: 'GET',
  });
}
/**
 * @description: 修改单条账目信息
 */
export function editBill(params: EditBillParams) {
  return defHttp.request<GetBillListModel>({
    url: Api.BillUrl + '/' + params.id,
    method: 'PUT',
    params,
  });
}

/**
 * @description: 修改单条账目信息
 */
export function getYearFee(params: GetFeeParams) {
  return defHttp.request<GetFeeModel>({
    url: Api.FeeUrl,
    method: 'get',
    params,
  });
}
