import http from '@/axios'
import { DictBO, DictQuery, DictTreeVO, DictVO } from '@/api/interface/system/dict'

class DictApi {
  /**
   * @name 查询树结构
   * @returns returns
   */
  static tree = (): Promise<ResultData<any>> => {
    return http.get<DictTreeVO>({ url: '/system/dict/tree' })
  }

  /**
   * @name 查询分页
   * @returns returns
   */
  static page = (params: DictQuery): Promise<ResultData<any>> => {
    return http.get<DictVO>({ url: '/system/dict/page', params })
  }

  /**
   * @name 查询列表
   * @returns returns
   */
  static list = (params: DictBO): Promise<ResultData<any>> => {
    return http.get<DictVO>({ url: '/system/dict/list', params })
  }

  /**
   * @name 查询列表
   * @returns returns
   */
  static map = (): Promise<ResultData<any>> => {
    return http.get<DictVO>({ url: '/system/dict/map' })
  }

  /**
   * @name 添加
   * @returns returns
   */
  static add = (data: DictBO): Promise<ResultData<any>> => {
    return http.post({ url: '/system/dict/add', data })
  }
  /**
   * @name 更新
   * @returns returns
   */
  static edit = (data: DictBO): Promise<ResultData<any>> => {
    return http.put({ url: '/system/dict/edit', data })
  }

  /**
   * @name 更新
   * @returns returns
   */
  static delete = (data: DictBO): Promise<ResultData<any>> => {
    return http.delete({ url: '/system/dict/delete', data })
  }
}
export default DictApi
