import request from '@/request'

/**
 * 获取角色列表
 */
export const queryRoleList = (params: {
  tenantId: string
}): Promise<
  ResponseData<
    {
      roleName: string
      roleId: string
    }[]
  >
> => {
  return request.post('/role/queryList', params)
}

/**
 * 全局系统参数保存
 */

export const saveSystemConfig = (params: {
  parameterId?: string | null
  paramCode: string
  paramName: string
  paramValue: string
  paramDesc?: string
  remark?: string
}): Promise<ResponseData<object>> => {
  return request.post('/system/parameter/upsert', params)
}

/**
 * 全局系统参数查询
 */
export const querySystemConfig = (params: {
  paramCode?: string
}): Promise<
  ResponseData<
    {
      paramId: number
      paramCode: string
      paramName: string
      paramValue: string
      paramDesc: string
      remark: string
    }[]
  >
> => {
  return request.post('/system/parameter/query', params)
}

/**
 * 全局系统参数删除
 */
export const deleteSystemConfig = (params: { paramId: string }): Promise<ResponseData<object>> => {
  return request.post('/system/parameter/delete', params)
}
