import { S as StorageAdapter } from '../../types-BaZccpvk.js';
import { R as RequestAdapter } from '../../types-CbTsi9CZ.js';

/**
 * Auth Client - Types
 * API 客户端类型定义
 */
/**
 * API 响应类型
 */
interface ApiResponse<T = any> {
    success: boolean;
    data?: T;
    error?: string;
    message?: string;
}
/**
 * 用户类型
 */
interface User {
    id: string;
    email: string;
    username: string;
    role: string;
    nickname?: string;
    avatar?: string;
    image?: string;
}
/**
 * 认证响应类型
 */
interface AuthResponse {
    user: User;
    token: string;
}
/**
 * 存储键名
 */
declare const STORAGE_KEYS: {
    readonly AUTH_TOKEN: "auth_token";
    readonly USER_DATA: "user_data";
};
/**
 * API 路由
 */
declare const API_ROUTES: {
    readonly AUTH: {
        readonly LOGIN: "/auth/login";
        readonly REGISTER: "/auth/register";
        readonly LOGOUT: "/auth/logout";
        readonly ME: "/auth/me";
    };
};

/**
 * Auth Client - Base API Client
 * 基础 API 客户端
 */

/**
 * 基础 API 客户端
 * 提供统一的 API 调用逻辑，通过适配器模式支持多平台
 *
 * @example
 * ```typescript
 * import { BaseApiClient } from '@qhr123/sa2kit/auth/client';
 * import { WebStorageAdapter } from '@qhr123/sa2kit/storage';
 * import { WebRequestAdapter } from '@qhr123/sa2kit/request';
 *
 * const apiClient = new BaseApiClient(
 *   new WebStorageAdapter(),
 *   new WebRequestAdapter(),
 *   '/api'
 * );
 *
 * await apiClient.init();
 * const result = await apiClient.login('user@example.com', 'password');
 * ```
 */
declare class BaseApiClient {
    private storage;
    private request;
    private baseUrl;
    private token;
    private user;
    constructor(storage: StorageAdapter, request: RequestAdapter, baseUrl: string);
    /**
     * 初始化 - 从存储中加载 token 和用户信息
     */
    init(): Promise<void>;
    /**
     * 设置认证 token
     */
    setToken(token: string | null): Promise<void>;
    /**
     * 设置用户信息
     */
    setUser(user: User | null): Promise<void>;
    /**
     * 获取当前 token
     */
    getToken(): string | null;
    /**
     * 获取当前用户
     */
    getUser(): User | null;
    /**
     * 检查是否已登录
     */
    isAuthenticated(): Promise<boolean>;
    /**
     * 清除用户数据
     */
    clearUserData(): Promise<void>;
    /**
     * 发送请求的通用方法
     */
    private sendRequest;
    /**
     * 用户注册
     */
    register(email: string, password: string, username: string): Promise<ApiResponse<AuthResponse>>;
    /**
     * 用户登录
     */
    login(email: string, password: string): Promise<ApiResponse<AuthResponse>>;
    /**
     * 用户退出登录
     */
    logout(): Promise<void>;
    /**
     * 获取当前用户信息
     */
    getCurrentUser(): Promise<ApiResponse<User>>;
    /**
     * 发送 GET 请求
     */
    get<T = any>(url: string, params?: Record<string, any>): Promise<ApiResponse<T>>;
    /**
     * 发送 POST 请求
     */
    post<T = any>(url: string, body?: any): Promise<ApiResponse<T>>;
    /**
     * 发送 PUT 请求
     */
    put<T = any>(url: string, body?: any): Promise<ApiResponse<T>>;
    /**
     * 发送 DELETE 请求
     */
    delete<T = any>(url: string): Promise<ApiResponse<T>>;
}

export { API_ROUTES, type ApiResponse, type AuthResponse, BaseApiClient, STORAGE_KEYS, type User };
