import request from '@/config/axios'

export interface KeyVO {
  keyId?: number
  keyCode: string
  keyName: string
  enableFlag?: string
  remark?: string
  createBy?: string
  createTime?: Date
  updateBy?: string
  updateTime?: Date
}

export interface PageParam {
  pageNo: number
  pageSize: number
  keyCode?: string
  keyName?: string
  enableFlag?: string
}

// 查询钥匙-列表
export const listKeyAPI = async (params: PageParam) => {
  return await request.get({ url: '/iscs/key/getKeyPage', params })
}

// 获取钥匙详细信息
export const getKeyInfoAPI = async (id: number) => {
  return await request.get({
    url: '/iscs/key/selectKeyById',
    params: { id }
  })
}

// 新增钥匙
export const addKeyAPI = async (data: KeyVO) => {
  return await request.post({ url: '/iscs/key/insertKey', data })
}

// 修改钥匙
export const updateKeyAPI = async (data: KeyVO) => {
  return await request.put({ url: '/iscs/key/updateKey', data })
}

// 删除钥匙
export const delKeyAPI = async (ids: number) => {
  return await request.delete({
    url: '/iscs/key/deleteKeyList?ids='+ids,
  })
}
