import { http } from '@/api/request'
import type { Dept } from '@/types/system'

export function listDept(): Promise<Dept[]> {
  return http.get('/system/dept/list')
}

export function getDept(id: number): Promise<Dept> {
  return http.get(`/system/dept/${id}`)
}

export function addDept(data: Partial<Dept>): Promise<void> {
  return http.post('/system/dept', data)
}

export function updateDept(data: Partial<Dept>): Promise<void> {
  return http.put('/system/dept', data)
}

export function deleteDept(id: number): Promise<void> {
  return http.delete(`/system/dept/${id}`)
}
