import { request } from '@/api/_service'

const BASE = 'system_settings/user_management/user/'

export function getUserList (data) {
  return request({
    url: BASE + 'list',
    method: 'get',
    params: {
      method: 'system_settings_user_management_user_list',
      platform: 'background',
      ...data
    }
  })
}

export function createUser (data) {
  return request({
    url: BASE + 'create',
    method: 'post',
    data: {
      method: 'system_settings_user_management_user_create',
      platform: 'background',
      ...data
    }
  })
}

export function editUser (data) {
  return request({
    url: BASE + 'edit',
    method: 'put',
    data: {
      method: 'system_settings_user_management_user_edit',
      platform: 'background',
      ...data
    }
  })
}

export function deleteUser (data) {
  return request({
    url: BASE + 'delete',
    method: 'delete',
    data: {
      method: 'system_settings_user_management_user_delete',
      platform: 'background',
      ...data
    }
  })
}

export function batchDeleteUser (data) {
  return request({
    url: BASE + 'batch_delete',
    method: 'delete',
    data: {
      method: 'system_settings_user_management_user_batch_delete',
      platform: 'background',
      ...data
    }
  })
}

export function enableUser (data) {
  return request({
    url: BASE + 'enable',
    method: 'put',
    data: {
      method: 'system_settings_user_management_enable_user',
      platform: 'background',
      ...data
    }
  })
}

export function disableUser (data) {
  return request({
    url: BASE + 'disable',
    method: 'put',
    data: {
      method: 'system_settings_user_management_disable_user',
      platform: 'background',
      ...data
    }
  })
}

export function resetUserPwd (data) {
  return request({
    url: BASE + 'reset_pwd',
    method: 'put',
    data: {
      method: 'system_settings_user_management_user_reset_pwd',
      platform: 'background',
      ...data
    }
  })
}

export function updateUserPwd (data) {
  return request({
    url: BASE + 'update_pwd',
    method: 'put',
    data: {
      method: 'system_settings_user_management_user_update_pwd',
      platform: 'background',
      ...data
    }
  })
}
