import type {
  AxiosRequestConfig,
  AxiosResponse,
  AxiosError,
  InternalAxiosRequestConfig // 导入内部类型
} from 'axios'

export interface ApiResponse<T = unknown> {
  code: number
  msg: string
  data: T
  isUserNotExist?: boolean
}

// 修正拦截器类型，使用 InternalAxiosRequestConfig
export type RequestInterceptor = (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig>
export type RequestErrorInterceptor = (error: AxiosError) => Promise<AxiosError>
export type ResponseInterceptor = <T = unknown>(response: AxiosResponse<ApiResponse<T>>) => T | Promise<T>
export type ResponseErrorInterceptor = (error: AxiosError) => Promise<AxiosError>
