import request from '@/utils/request';
import type { AxiosPromise } from 'axios';
import type { LoginForm } from './types';

/**
 *
 * @param data {LoginForm}
 * @returns
 */
// export function loginApi(data: LoginForm): AxiosPromise<string> {
//   return request({
//     url: '/api/bpel/event',
//     method: 'post',
//     data: data,
//     // headers: {
//     //   Authorization: 'Basic dnVlMy1lbGVtZW50LWFkbWluOnNlY3JldA==' // 客户端信息Base64明文：vue3-element-admin:secret
//     // }
//   });
// }
export function loginApi(data: LoginForm): AxiosPromise<string> {
  return request({
    url: '/api/login/LoginCheck',
    method: 'post',
    data: data,
    // headers: {
    //   Authorization: 'Basic dnVlMy1lbGVtZW50LWFkbWluOnNlY3JldA==' // 客户端信息Base64明文：vue3-element-admin:secret
    // }
  });
}

/**
 * 注销
 */
export function logoutApi() {
  return request({
    url: '/api/v1/auth/logout',
    method: 'delete'
  });
}

/**
 * 获取RSA公钥
 */
export function getRSAPublic() {
  return request({
    url: '/rsa/public',
    method: 'get'
  });
}
// 获取组织
export function getORG(params: any) {
  return request({
    url: '/api/login/getORG',
    method: 'post',
    data: params,
  });
}
/**
 *  获取当前用户的所有菜单
 */
export function allMenuApi(params: any) {
  return request({
    url: '/api/menu/getHierarchicalMenuOfPermission',
    method: 'post',
    data: params,
  });
}
/**
 *  获取当前用户的所有按钮
 */
export function allButtonApi(data: any) {
  return request({
    url: '/button/perm/list',
    method: 'post',
    data: data
  });
}

/**
 * 修改密码
 */
export function changePssword(data: any) {
  return request({
    url: '/api/user/changePassword',
    method: 'post',
    data: data
  });
}

