import { createAPIModule } from '../utils/apiService';

import * as APIConfigs from '../assets/data/apis'

export * from './Admin';
export * from './Auth';
export * from './Group';
export * from './History';
export * from './Mail';
export * from './Notice';
export * from './BlackList';
export * from './Users';
export * from './Indicators';
export * from './Item';
export * from './Event';
export * from './Calium';
export * from './Land';
export * from './Menu';
// export * from './OpenAI';
export * from './Log';

const apiModules = {};
const allApis = {};

// 각 API 설정에 대해 모듈 생성
Object.entries(APIConfigs).forEach(([configName, config]) => {
	const moduleName = configName.replace(/API$/, ''); // "userAPI" -> "user"
	apiModules[moduleName] = createAPIModule(config);

	// 모든 API 함수 추출해서 allApis에 복사
	Object.entries(apiModules[moduleName]).forEach(([fnName, fn]) => {
		allApis[fnName] = fn;
	});
});

export const Modules = apiModules;

// export const ItemAPI = createAPIModule(itemAPIConfig);