import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/goldenwater";

export function listContract(query) {
  return request({ url: '/pms/contract/list', method: 'get', params: query })
}

export function getContract(conId) {
  return request({ url: '/pms/contract/' + parseStrEmpty(conId), method: 'get' })
}

export function addContract(data) {
  return request({ url: '/pms/contract', method: 'post', data: data })
}

export function updateContract(data) {
  return request({ url: '/pms/contract', method: 'put', data: data })
}

export function delContract(conId) {
  return request({ url: '/pms/contract/' + conId, method: 'delete' })
}

export function listContractFee(query) {
  return request({ url: '/pms/contract/fee/list', method: 'get', params: query })
}

export function addContractFee(data) {
  return request({ url: '/pms/contract/fee', method: 'post', data: data })
}

export function updateContractFee(data) {
  return request({ url: '/pms/contract/fee', method: 'put', data: data })
}

export function delContractFee(feeId) {
  return request({ url: '/pms/contract/fee/' + feeId, method: 'delete' })
}

export function listContractBill(query) {
  return request({ url: '/pms/contract/bill/list', method: 'get', params: query })
}

export function addContractBill(data) {
  return request({ url: '/pms/contract/bill', method: 'post', data: data })
}

export function updateContractBill(data) {
  return request({ url: '/pms/contract/bill', method: 'put', data: data })
}

export function delContractBill(billId) {
  return request({ url: '/pms/contract/bill/' + billId, method: 'delete' })
}

export function listContractPayment(query) {
  return request({ url: '/pms/contract/payment/list', method: 'get', params: query })
}

export function addContractPayment(data) {
  return request({ url: '/pms/contract/payment', method: 'post', data: data })
}

export function updateContractPayment(data) {
  return request({ url: '/pms/contract/payment', method: 'put', data: data })
}

export function delContractPayment(payId) {
  return request({ url: '/pms/contract/payment/' + payId, method: 'delete' })
}

export function listContractLog(query) {
  return request({ url: '/pms/contract/log/list', method: 'get', params: query })
}

export function addContractLog(data) {
  return request({ url: '/pms/contract/log', method: 'post', data: data })
}

export function delContractLog(logId) {
  return request({ url: '/pms/contract/log/' + logId, method: 'delete' })
}

export function listContractRef(query) {
  return request({ url: '/pms/contract/ref/list', method: 'get', params: query })
}

export function addContractRef(data) {
  return request({ url: '/pms/contract/ref', method: 'post', data: data })
}

export function delContractRef(refId) {
  return request({ url: '/pms/contract/ref/' + refId, method: 'delete' })
}
