import {
  Configuration,
  BaseUserApi,
  TestApi,
} from '@/api';
import { axios } from 'hpsfir-managebase-ui';

interface BaseApi {
  baseUrl: string;
  uploadFileUrl: string;
  baseUserApi: BaseUserApi;
  testApi: TestApi;
}

const api: BaseApi = {

} as any;

export const initApi = (basePath: string) => {
  const apiConfig = new Configuration({
    basePath,
  });
  api.baseUrl = basePath;
  api.uploadFileUrl = '/upload/file';
  api.baseUserApi = new BaseUserApi(apiConfig, basePath, axios);
  api.testApi = new TestApi(apiConfig, basePath, axios);
};

export const useApi = () => api;

