import request from '@/utils/request'

// 创建检验检疫
export function createInspection(data) {
  return request({
    url: '/product/inspection/create',
    method: 'post',
    data: data
  })
}

// 更新检验检疫
export function updateInspection(data) {
  return request({
    url: '/product/inspection/update',
    method: 'put',
    data: data
  })
}

// 删除检验检疫
export function deleteInspection(id) {
  return request({
    url: '/product/inspection/delete?id=' + id,
    method: 'delete'
  })
}

// 获得检验检疫
export function getInspection(id) {
  return request({
    url: '/product/inspection/get?id=' + id,
    method: 'get'
  })
}

// 获得检验检疫分页
export function getInspectionPage(query) {
  return request({
    url: '/product/inspection/page',
    method: 'get',
    params: query
  })
}

// 导出检验检疫 Excel
export function exportInspectionExcel(query) {
  return request({
    url: '/product/inspection/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 激活检验检疫
export function inspectionActive(id) {
  return request({
    url: '/product/inspection/active?id='+id,
    method: 'put',
  })
}

// 冻结检验检疫
export function inspectionFreeze(id) {
  return request({
    url: '/product/inspection/freeze?id='+id,
    method: 'put',
  })
}

// 上链检验检疫
export function inspectionUpChain(id) {
  return request({
    url: '/product/inspection/upChain?id='+id,
    method: 'put',
  })
}

// 获得检验检疫
export function getInspectionByHarvestBatchId(harvestBatchId) {
  return request({
    url: '/product/inspection/getByHarvestBatchId?harvestBatchId=' + harvestBatchId,
    method: 'get'
  })
}
