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

// 查询驾驶员列表
export function listDriver(query) {
  return request({
    url: '/system/driver/list',
    method: 'get',
    params: query
  })
}

// 查询驾驶员详细
export function getDriver(driverId) {
  return request({
    url: '/system/driver/' + parseStrEmpty(driverId),
    method: 'get'
  })
}

// 新增驾驶员
export function addDriver(data) {
  return request({
    url: '/system/driver',
    method: 'post',
    data: data
  })
}

// 修改驾驶员
export function updateDriver(data) {
  return request({
    url: '/system/driver',
    method: 'put',
    data: data
  })
}

// 删除驾驶员
export function delDriver(driverId) {
  return request({
    url: '/system/driver/' + driverId,
    method: 'delete'
  })
}

// 驾驶员状态修改
export function changeDriverStatus(driverId, status) {
  const data = {
    driverId,
    status
  }
  return request({
    url: '/system/driver/changeStatus',
    method: 'put',
    data: data
  })
}

// 用户头像上传
export function uploadAvatar(data) {
  return request({
    url: '/system/driver/avatar',
    method: 'post',
    data: data
  })
}

// 获取驾驶员初始密码
export function getInitPassword() {
  return request({
    url: '/system/driver/initPassword',
    method: 'get'
  })
} 