import http from "@/util/http.js"

export function getSupplier(params) {
  return http({
    url: "/api/supplier",
    method: "get",
    params
  })
}

export function removeSupplier(id) {
  return http({
    url: `/api/supplier/${id}`,
    method: "delete"
  })
}

export function addSupplier(data) {
  return http({
    url: "/api/supplier",
    method: "post",
    data
  })
}

export function updateSupplier(id, data) {
  return http({
    url: `/api/supplier/${id}`,
    method: "patch",
    data
  })
}

export function getPurchaseLog(params) {
  return http({
    url: "/api/supplier/purchase_record",
    method: "get",
    params
  })
}

export function examinePurchase(data) {
  return http({
    url: "/api/purchase_record/purchase_batch_check",
    method: "post",
    data
  })
}

export function addPurchaseLog(data) {
  return http({
    url: "/api/supplier/purchase_record",
    method: "post",
    data
  })
}

export function batchAddPurchaseLog(data) {
  return http({
    url: "/api/purchase_record/purchase_batch_store",
    method: "post",
    data
  })
}

export function updatePurchaseLog(id, data) {
  return http({
    url: `/api/supplier/purchase_record/${id}`,
    method: "patch",
    data
  })
}

export function getLossLog(params) {
  return http({
    url: "/api/supplier/loss_record",
    method: "get",
    params
  })
}

export function addLossLog(data) {
  return http({
    url: "/api/supplier/loss_record",
    method: "post",
    data
  })
}

export function batchAddLossLog(data) {
  return http({
    url: "/api/loss_record/loss_batch_store",
    method: "post",
    data
  })
}

export function updateLossLog(id, data) {
  return http({
    url: `/api/supplier/loss_record/${id}`,
    method: "patch",
    data
  })
}

export function getDailyStock(params) {
  return http({
    url: "/api/supplier/daily_stock_record",
    method: "get",
    params
  })
}

export function addDailyStock(data) {
  return http({
    url: "/api/supplier/daily_stock_record",
    method: "post",
    data
  })
}

export function batchAddDailyStock(data) {
  return http({
    url: "/api/daily_stock_record/inventory_batch_store",
    method: "post",
    data
  })
}

