import { get, post, put, del } from '../../http'

// 定义接口类型
export interface GradeFormType {
  [key: string]: any
  description?: string
  grade?: number
  id?: string
  name?: string
}

/**
 * @description: 获取查询等级列表
 * @param {*} params
 * @return {*}
 */
export const getGradeList = async (params: Record<string, any>) => {
  return await get<any>('/grade/list', { params })
}

/**
 * @description: 更新编辑等级列表
 * @param {*} data
 * @return {*}
 */
export const updateGradeList = async (data: GradeFormType) => {
  return await put('/grade', data)
}

/**
 * @description: 新增等级
 * @param {*} data
 * @return {*}
 */
export const addGradeList = async (data: Record<string, any>) => {
  return await post<any>('/grade', data)
}
/**
 * @description: 根据id查询等级表
 * @param {*} params
 * @return {*}
 */
export const getGradeById = async (id: string) => {
  return await get<any>(`/grade/${id}`)
}

/**
 * @description: 根据等级删除
 * @return {*}
 */
export const delGradeList = async (grade: number) => {
  return await del(`/grade/deleteGrade/${grade}`)
}
/**
 * @description: 字典查询
 * @return {*}
 */
export const getDictDataList = async (code: string) => {
  return await get<any>(`/sysDictType/listSysDictData/${code}`)
}
