import type { AxiosRequestConfig, AxiosResponse } from "axios"

export interface HttpRequestConfig extends AxiosRequestConfig {
  ignoreSSL?: boolean
  timeout?: number
}

// Limited interface we want to expose
export type HttpService = {
  get<T = any>(
    url: string,
    config?: HttpRequestConfig,
  ): Promise<AxiosResponse<T>>
  post<T = any>(
    url: string,
    data?: any,
    config?: HttpRequestConfig,
  ): Promise<AxiosResponse<T>>
  put<T = any>(
    url: string,
    data?: any,
    config?: HttpRequestConfig,
  ): Promise<AxiosResponse<T>>
  delete<T = any>(
    url: string,
    config?: HttpRequestConfig,
  ): Promise<AxiosResponse<T>>
}

export interface HttpPluginOptions {
  timeout?: number
  defaultHeaders?: Record<string, string>
}
