// import type { RequestClientConfig } from '@vben/request';

import { cdcmRequestClient } from '#/api/request';

// export namespace CDCM {
//   export interface action {
//     config: RequestClientConfig;
//   }
// }

export namespace AuthApi {
  /** 登录接口参数 */
  export interface LoginParams {
    password?: string;
    username?: string;
  }

  /** 登录接口返回值 */
  export interface LoginResult {
    data: {
      data: {
        support_driver_types?: string[];
        support_point_access_types?: string[];
        support_point_types?: string[];
        support_template_types?: string[];
      };
    };
  }

  export interface RefreshTokenResult {
    data: string;
    status: number;
  }
}

/**
 * 登录
 */
export async function loginApi(data: AuthApi.LoginParams) {
  return cdcmRequestClient.post<AuthApi.LoginResult>('/auth/login', data);
}

/**
 * 退出登录
 */
export async function logoutApi() {
  return cdcmRequestClient.post('/auth/logout', {});
}
