import request from '@/utils/request'

// 查询大棚管理列表
export function listAgri(query) {
  return request({
    url: '/assets/agri/list',
    method: 'get',
    params: query
  })
}

// 查询大棚管理详细
export function getAgri(id) {
  return request({
    url: '/assets/agri/' + id,
    method: 'get'
  })
}
export function getAgriInfo(query) {
  return request({
    url: '/assets/agri/findAgriInfoByUser',
    method: 'get',
    params: query
  })
}

// 新增大棚管理
export function addAgri(data) {
  return request({
    url: '/assets/agri',
    method: 'post',
    data: data
  })
}

// 修改大棚管理
export function updateAgri(data) {
  return request({
    url: '/assets/agri',
    method: 'put',
    data: data
  })
}
export function renameAgriName(data) {
  return request({
    url: '/assets/agri/renameAgriName',
    method: 'put',
    params: data
  })
}

// 删除大棚管理
export function delAgri(id) {
  return request({
    url: '/assets/agri/' + id,
    method: 'delete'
  })
}

/**
 * 移动端添加大棚
 * @param data
 * @returns {*}
 */
export function addAgriMobile(data) {
  return request({
    url: '/assets/agri/addAgriFromMobile',
    method: 'post',
    data: data
  })
}
export function switchAgriMode(imei, code) {
  return request({
    url: '/assets/agri/switchAgriMode/' + imei,
    method: 'post',
    params: code
  })
}