import request from '@/utils/request';

// 获取当前用户的伙伴商信息
export function getCurrentPartnerInfo() {
  return request({
    url: '/customer/partnerInfo/current',
    method: 'get'
  });
}

// 修改伙伴商基本信息
export function updatePartnerInfo(data: any) {
  return request({
    url: '/customer/partnerInfo',
    method: 'put',
    data
  });
}

// 查询伙伴商列表
export function listPartnerInfo(query?: any) {
  return request({
    url: '/customer/partnerInfo/list',
    method: 'get',
    params: query
  });
}

// 获取伙伴商银行列表
export function getPartnerBankList(partnerId: number) {
  return request({
    url: '/customer/partnerBank/list',
    method: 'get',
    params: { partnerId }
  });
}

// 获取伙伴商联系人列表
export function getPartnerContactsList(partnerId: number) {
  return request({
    url: '/customer/partnerContacts/list',
    method: 'get',
    params: { partnerId }
  });
}

// 获取伙伴商合同列表
export function getPartnerContractList(partnerId: number) {
  return request({
    url: '/customer/partnerContract/list',
    method: 'get',
    params: { partnerId }
  });
}

// 获取伙伴商仓库列表
export function getPartnerWarehouseList(partnerId: number) {
  return request({
    url: '/customer/partnerWarehouse/list',
    method: 'get',
    params: { partnerId }
  });
}

// 获取伙伴商资质列表
export function getPartnerQualificationList(partnerId: number) {
  return request({
    url: '/customer/partnerQualification/list',
    method: 'get',
    params: { partnerId }
  });
}

// 新增伙伴商银行账户
export function addPartnerBank(data: any) {
  return request({
    url: '/customer/partnerBank',
    method: 'post',
    data
  });
}

// 修改伙伴商银行账户
export function updatePartnerBank(data: any) {
  return request({
    url: '/customer/partnerBank',
    method: 'put',
    data
  });
}

// 删除伙伴商银行账户
export function deletePartnerBank(ids: number[]) {
  return request({
    url: `/customer/partnerBank/${ids.join(',')}`,
    method: 'delete'
  });
}

// 新增伙伴商联系人
export function addPartnerContacts(data: any) {
  return request({
    url: '/customer/partnerContacts',
    method: 'post',
    data
  });
}

// 修改伙伴商联系人
export function updatePartnerContacts(data: any) {
  return request({
    url: '/customer/partnerContacts',
    method: 'put',
    data
  });
}

// 删除伙伴商联系人
export function deletePartnerContacts(ids: number[]) {
  return request({
    url: `/customer/partnerContacts/${ids.join(',')}`,
    method: 'delete'
  });
}

// 新增伙伴商合同
export function addPartnerContract(data: any) {
  return request({
    url: '/customer/partnerContract',
    method: 'post',
    data
  });
}

// 修改伙伴商合同
export function updatePartnerContract(data: any) {
  return request({
    url: '/customer/partnerContract',
    method: 'put',
    data
  });
}

// 删除伙伴商合同
export function deletePartnerContract(ids: number[]) {
  return request({
    url: `/customer/partnerContract/${ids.join(',')}`,
    method: 'delete'
  });
}

// 新增伙伴商仓库
export function addPartnerWarehouse(data: any) {
  return request({
    url: '/customer/partnerWarehouse',
    method: 'post',
    data
  });
}

// 修改伙伴商仓库
export function updatePartnerWarehouse(data: any) {
  return request({
    url: '/customer/partnerWarehouse',
    method: 'put',
    data
  });
}

// 删除伙伴商仓库
export function deletePartnerWarehouse(ids: number[]) {
  return request({
    url: `/customer/partnerWarehouse/${ids.join(',')}`,
    method: 'delete'
  });
}

// 新增伙伴商资质
export function addPartnerQualification(data: any) {
  return request({
    url: '/customer/partnerQualification',
    method: 'post',
    data
  });
}

// 修改伙伴商资质
export function updatePartnerQualification(data: any) {
  return request({
    url: '/customer/partnerQualification',
    method: 'put',
    data
  });
}

// 删除伙伴商资质
export function deletePartnerQualification(ids: number[]) {
  return request({
    url: `/customer/partnerQualification/${ids.join(',')}`,
    method: 'delete'
  });
}
