/**
 * 区域管理API
 * @author pangu
 */
import request from '@/utils/request'

// 获取区域树
export function getRegionTree() {
  return request({
    url: '/api/region/tree',
    method: 'get'
  })
}

// 获取区域列表
export function getRegionList(params) {
  return request({
    url: '/api/region/list',
    method: 'get',
    params
  })
}

// 获取区域详情
export function getRegionDetail(id) {
  return request({
    url: `/api/region/${id}`,
    method: 'get'
  })
}

// 新增区域
export function addRegion(data) {
  return request({
    url: '/api/region',
    method: 'post',
    data
  })
}

// 修改区域
export function updateRegion(data) {
  return request({
    url: '/api/region',
    method: 'put',
    data
  })
}

// 删除区域
export function deleteRegion(id) {
  return request({
    url: `/api/region/${id}`,
    method: 'delete'
  })
}
