import microRequest from '@/utils/micro_request';

const basePath = import.meta.env.VITE_SCIENTIFIC;

// 经费认领
export function useClaimApi() {
  return {
    getList: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllotApply', 'GetList', query),
    update: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllotApply', 'UpdateById', query),
    create: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllotApply', 'Create', query),
    getDetails: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllotApply', 'GetEntityById', query),
    del: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllotApply', 'DeleteByIds', query),
    approval: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllotApply', 'Approve', query),
    getRecordList: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllot', 'GetList', query),
    getRecordDetails: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllot', 'GetEntityById', query),
    createRecord: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllot', 'Create', query),
    export: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllot', 'Export', query),
    import: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllot', 'Import', query),
    delRecord: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllot', 'DeleteByIds', query),
    withdraw: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllotApply', 'QuashApprove', query),
    getFundsStatistics: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllot', 'GetFundsStatistics', query),
    getFundAllotNotice: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllot', 'GetFundAllotNotice', query),
    getBudgetList: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllot', 'BudgetList', query),
    getListByProject: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllot', 'GetListByProject', query),
    getEntityByFundId: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllotApply', 'GetEntityByFundId', query),
    exportFundAllotNoticePDF: (query?: object) => microRequest.postRequest(basePath, 'SciFundAllot', 'ExportFundAllotNoticePDF', query),
  };
}

// 经费报销提醒
export function useExpenseRemindApi() {
  return {
    getList: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpenseNotice', 'GetList', query),
    getDetails: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpenseNotice', 'GetEntityById', query),
    create: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpense', 'CreateFromNotice', query),
  };
}

// 经费报销
export function useRebateApi() {
  return {
    getList: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpense', 'GetList', query),
    update: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpense', 'UpdateById', query),
    create: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpense', 'Create', query),
    getDetails: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpense', 'GetEntityById', query),
    getExpenseByNoticeId: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpense', 'GetExpenseByNoticeId', query),
    del: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpense', 'DeleteByIds', query),
    approval: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpense', 'Approve', query),
    getHorizontalExpenseList: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpense', 'GetHorizontalExpenseList', query),
    export: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpense', 'Export', query),
    import: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpense', 'Import', query),
    withdraw: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpense', 'QuashApprove', query),
    getPDFPrintData: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpense', 'GetPDFPrintData', query),
    getPrintDataById: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpense', 'GetPrintDataById', query),
    exportPrintDataPDF: (query?: object) => microRequest.postRequest(basePath, 'SciFundExpense', 'ExportPrintDataPDF', query),
  };
}

// 财务到款(公共)
export function useFundApi() {
  return {
    getList: (query?: object) => microRequest.postRequest(basePath, 'SciFund', 'GetList', query),
    update: (query?: object) => microRequest.postRequest(basePath, 'SciFund', 'UpdateById', query),
    create: (query?: object) => microRequest.postRequest(basePath, 'SciFund', 'Create', query),
    getDetails: (query?: object) => microRequest.postRequest(basePath, 'SciFund', 'GetEntityById', query),
    del: (query?: object) => microRequest.postRequest(basePath, 'SciFund', 'DeleteByIds', query),
    export: (query?: object) => microRequest.postRequest(basePath, 'SciFund', 'Export', query),
    import: (query?: object) => microRequest.postRequest(basePath, 'SciFund', 'Import', query),
    getParentList: (query?: object) => microRequest.postRequest(basePath, 'SciSubj', 'GetParentList', query),
    getAllFirstSubj: (query?: object) => microRequest.postRequest(basePath, 'SciSubj', 'GetAllFirstSubj', query),
  };
}

// 经费卡
export function useFundCardApi() {
  return {
    getList: (query?: object) => microRequest.postRequest(basePath, 'SciFundCard', 'GetList', query),
    getDetails: (query?: object) => microRequest.postRequest(basePath, 'SciFundCard', 'GetEntityById', query),
    create: (query?: object) => microRequest.postRequest(basePath, 'SciFundCard', 'Create', query),
    delete: (query?: object) => microRequest.postRequest(basePath, 'SciFundCard', 'DeleteByIds', query),
    update: (query?: object) => microRequest.postRequest(basePath, 'SciFundCard', 'UpdateById', query),
    getDetailsList: (query?: object) => microRequest.postRequest(basePath, 'SciFundCard', 'GetDetailList', query),
    getAllFundsStatistics: (query?: object) => microRequest.postRequest(basePath, 'SciFundCard', 'GetAllFundsStatistics', query),
    getSubjAmount: (query?: object) => microRequest.postRequest(basePath, 'SciFundCard', 'GetSubjAmount', query),
  };
}

// 科目/支出 (useExpenseApi)
export function useExpenseApi() {
  return {
    getList: (query?: object) => microRequest.postRequest(basePath, 'SciSubj', 'GetList', query),
    getParentList: (query?: object) => microRequest.postRequest(basePath, 'SciSubj', 'GetParentList', query),
    GetListNoPage: (query?: object) => microRequest.postRequest(basePath, 'SciSubj', 'GetListNoPage', query),
    getEntityById: (query?: object) => microRequest.postRequest(basePath, 'SciSubj', 'GetEntityById', query),
    create: (query?: object) => microRequest.postRequest(basePath, 'SciSubj', 'Create', query),
    deleteByIds: (query?: object) => microRequest.postRequest(basePath, 'SciSubj', 'DeleteByIds', query),
    updateById: (query?: object) => microRequest.postRequest(basePath, 'SciSubj', 'UpdateById', query),
    GetExtrationList: (query?: object) => microRequest.postRequest(basePath, 'Extration', 'GetExtrationList', query),
    GetExtrationById: (query?: object) => microRequest.postRequest(basePath, 'Extration', 'GetExtrationById', query),
    CreateExtration: (query?: object) => microRequest.postRequest(basePath, 'Extration', 'CreateExtration', query),
    DeleteExtrationByIds: (query?: object) => microRequest.postRequest(basePath, 'Extration', 'DeleteExtrationByIds', query),
    UpdateExtrationById: (query?: object) => microRequest.postRequest(basePath, 'Extration', 'UpdateExtrationById', query),
  };
}

// 报销附件配置
export function useBaseReimburseApi() {
  return {
    getList: (query?: object) => microRequest.postRequest(basePath, 'SciBaseReimburseFileConfigure', 'GetList', query),
    getEntityById: (query?: object) => microRequest.postRequest(basePath, 'SciBaseReimburseFileConfigure', 'GetEntityById', query),
    create: (query?: object) => microRequest.postRequest(basePath, 'SciBaseReimburseFileConfigure', 'Create', query),
    updateById: (query?: object) => microRequest.postRequest(basePath, 'SciBaseReimburseFileConfigure', 'UpdateById', query),
    deleteByIds: (query?: object) => microRequest.postRequest(basePath, 'SciBaseReimburseFileConfigure', 'DeleteByIds', query),
  };
}
