import request from '@/utils/request'

// 获取安装工单列表
export function getInstallationList(query) {
  return request({
    url: '/productManagement/installation/list',
    method: 'get',
    params: query
  })
}

// 获取安装工单详细信息
export function getInstallationDetail(id) {
  return request({
    url: `/productManagement/installation/${id}`,
    method: 'get'
  })
}

// 新增安装工单
export function addInstallation(data) {
  return request({
    url: '/productManagement/installation',
    method: 'post',
    data: data
  })
}

// 修改安装工单
export function updateInstallation(data) {
  return request({
    url: '/productManagement/installation',
    method: 'put',
    data: data
  })
}

// 删除安装工单
export function deleteInstallation(id) {
  return request({
    url: `/productManagement/installation/${id}`,
    method: 'delete'
  })
}

// 导出安装工单
export function exportInstallation(query) {
  return request({
    url: '/productManagement/installation/export',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 派单
export function dispatchInstallation(data) {
  return request({
    url: '/productManagement/installation/dispatch',
    method: 'post',
    data: data
  })
}

// 接单驳回
export function rejectInstallation(data) {
  return request({
    url: '/productManagement/installation/reject',
    method: 'post',
    data: data
  })
}

// 每日填写
export function dailyWrite(data) {
  return request({
    url: '/productManagement/installation/daily',
    method: 'post',
    data: data
  })
}

// 完成
export function completeInstallation(data) {
  return request({
    url: '/productManagement/installation/complete',
    method: 'post',
    data: data
  })
}

// 接单
export function acceptInstallation(data) {
  return request({
    url: '/productManagement/installation/accept',
    method: 'post',
    data: data
  })
}

// 验收
export function checkInstallation(data) {
  return request({
    url: '/productManagement/installation/check',
    method: 'post',
    data: data
  })
}

// 导出安装工单列表
// TO DO
export function exportInstallationOrder(data) {
  return request({
    url: '/api/installation/export',
    method: 'post',
    data,
    responseType: 'blob'
  })
}