import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';

export type HttpClient = {
    baseURL: string;
    headers: Record<string, string>;
    get: <T = unknown>(url: string, options?: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
    post: <T = unknown>(url: string, data: unknown, options?: AxiosRequestConfig) => Promise<AxiosResponse<T>>;
};

export const httpClient: HttpClient = {
    baseURL: 'http://localhost:3000',
    headers: {
        'Content-Type': 'application/json'
    },
    get: (url, options) => axios.get(url, options),
    post: (url, data, options = {}) => axios.post(url, data, options)
};
