import { HotSearchItem } from './hotSearch';

/**
 * 分页元数据接口
 */
export interface MetaData {
  /** 起始记录 */
  from: number;
  /** 总记录数 */
  total: number;
  /** 当前页码 */
  current_page: number;
  /** 最后页码 */
  last_page: number;
  /** 每页记录数 */
  per_page: number;
}

/**
 * 通用API响应接口
 */
export interface ApiResponse<T> {
  randomProgress: never[];
  cycle_progress: import("d:/code/ebiz/code/ylst-survey-h5/src/views/Survey/views/Analysis/components/LogicInfo/types/cycleProgress").CycleProgressItem[] | { title: string; num: number; option: string; start: number; end: number; precent: string; question_index: number; question_title: string; relation_type: number; is_fixed: number; is_fixed_select: number; quota_num: number; sample_num: number; group_info: string; }[];
  /** 响应状态码，0表示成功 */
  code: number;
  /** 响应消息，成功时为null */
  message: string | null;
  /** 响应数据 */
  data: T;
  /** 分页元数据，可选 */
  meta?: MetaData;
}

/**
 * Axios响应头部接口
 */
export interface AxiosResponseHeaders {
  'content-type': string;
  [key: string]: string;
}

/**
 * Axios配置接口
 */
export interface AxiosConfig {
  transitional: {
    silentJSONParsing: boolean;
    forcedJSONParsing: boolean;
    clarifyTimeoutError: boolean;
  };
  adapter: string[];
  transformRequest: any[];
  transformResponse: any[];
  timeout: number;
  xsrfCookieName: string;
  xsrfHeaderName: string;
  maxContentLength: number;
  maxBodyLength: number;
  env: Record<string, any>;
  headers: {
    Accept: string;
    'Content-Type': string;
    Authorization: string;
    Source: string;
    remoteIp: string;
    [key: string]: string;
  };
  baseURL: string;
  url: string;
  method: string;
  allowAbsoluteUrls: boolean;
  [key: string]: any;
}

/**
 * 完整的Axios响应接口
 */
export interface AxiosResponse<T> {
  /** 响应数据 */
  data: ApiResponse<T>;
  /** HTTP状态码 */
  status: number;
  /** HTTP状态文本 */
  statusText: string;
  /** 响应头 */
  headers: AxiosResponseHeaders;
  /** 请求配置 */
  config: AxiosConfig;
  /** 请求对象 */
  request: Record<string, any>;
}

/**
 * 热搜列表响应类型
 */
export type HotSearchResponse = AxiosResponse<HotSearchItem[]>;
type CycleProgressResponse = AxiosResponse<CycleProgress>