import { defHttp } from '@/utils/http/axios';

enum Api {
  // 企业信息
  LoadBidCompanyInfo = '/api/BidCompanyInfo/LoadBidCompanyInfo',
  LoadBiddingAgencyByUser = '/api/BiddingAgency/LoadBiddingAgencyByUser',
  UploadFile = '/api/Files/Upload',
  AddBidCompanyInfo = '/api/BidCompanyInfo/AddBidCompanyInfo',
  EditBidCompanyInfo = '/api/BidCompanyInfo/EditBidCompanyInfo',
  DeleteBidCompanyInfo = '/api/BidCompanyInfo/DeleteBidCompanyInfo',
  ReviewBidCompanyInfo = '/api/BidCompanyInfo/ReviewBidCompanyInfo',
  AddCompanyAccount = '/api/BidCompanyInfo/AddCompanyAccount',
}
const getRequestBidCompanyInfoListUrl = (userType) => {
  switch(userType){
    case 1:
      // 招标代理
      return '/api/BiddingAgency/LoadBiddingAgencyByUser'
    case 2:
      // 供应商
      return '/api/BidCompanyInfo/LoadCompanyInfoByUser'
    case 3:
      // 甲方公司
      return '/api/BidCompanyInfo/LoadBidCompanyInfo'
  }
}
// 企业信息
export function LoadBidCompanyInfo(params, userType) {
  return defHttp.get({
    url: getRequestBidCompanyInfoListUrl(userType),
    params,
  });
}
export function LoadBiddingAgencyByUser(params) {
  return defHttp.get({
    url: Api.LoadBiddingAgencyByUser,
    params,
  });
}
export const uploadFile = (params) => 
  defHttp.post({
    url: Api.UploadFile,
    params,
    headers: {
      'Content-type': 'multipart/form-data',
    },
  })
export function AddBidCompanyInfo(params) {
  return defHttp.post({
    url: Api.AddBidCompanyInfo,
    params,
  });
}
export function EditBidCompanyInfo(params) {
  return defHttp.post({
    url: Api.EditBidCompanyInfo,
    params,
  });
}
export function DeleteBidCompanyInfo(id) {
  return defHttp.post({
    url: `${Api.DeleteBidCompanyInfo}?id=${id}`,
  });
}
export function ReviewBidCompanyInfo(id) {
  return defHttp.post({
    url: `${Api.ReviewBidCompanyInfo}?id=${id}`,
  });
}
export function AddCompanyAccount(params) {
  return defHttp.post({
    url: Api.AddCompanyAccount,
    params,
  });
}