import { request } from '@/utils/request'

// 企业信息
export const enterpriseApi = {
  // 获取企业信息
  getCompanyInfo: () => request.get('/enterprise/company/info'),
  // 更新企业信息
  updateCompanyInfo: (data: any) => request.put('/enterprise/company/info', data),

  // 地址管理
  getAddressList: (params: any) => request.get('/enterprise/address/list', params),
  addAddress: (data: any) => request.post('/enterprise/address', data),
  updateAddress: (data: any) => request.put('/enterprise/address', data),
  deleteAddress: (id: number) => request.delete(`/enterprise/address/${id}`),
  setDefaultAddress: (id: number) => request.put(`/enterprise/address/${id}/default`),

  // 发票抬头管理
  getInvoiceList: (params: any) => request.get('/enterprise/invoice/list', params),
  addInvoice: (data: any) => request.post('/enterprise/invoice', data),
  updateInvoice: (data: any) => request.put('/enterprise/invoice', data),
  deleteInvoice: (id: number) => request.delete(`/enterprise/invoice/${id}`),

  // 消息通知
  getMessageList: (params: any) => request.get('/enterprise/message/list', params),
  readMessage: (id: number) => request.put(`/enterprise/message/${id}/read`),
  readAllMessage: () => request.put('/enterprise/message/read-all'),

  // 我的收藏
  getCollectionList: (params: any) => request.get('/enterprise/collection/list', params),
  removeCollection: (id: number) => request.delete(`/enterprise/collection/${id}`),

  // 历史购买
  getPurchaseHistory: (params: any) => request.get('/enterprise/purchase-history/list', params),

  // 我的足迹
  getFootprintList: (params: any) => request.get('/enterprise/footprint/list', params),
  clearFootprint: () => request.delete('/enterprise/footprint/clear'),

  // 协议供货
  getAgreementList: (params: any) => request.get('/enterprise/agreement/list', params),

  // 专属采购方案
  getPurchasePlan: (params: any) => request.get('/enterprise/purchase-plan/list', params)
}
