import { RESTEndpointHandler } from './RESTEndpointHandler.js';
export const ___REST_API_BASE_PATH = '/api/v1';
export const DEFAULT_REST_API_OPTIONS = {
    enabled: true,
};
export function setupRESTEndpoints(app, options, authMiddleware) {
    const config = { ...DEFAULT_REST_API_OPTIONS, ...options };
    if (!config.enabled) {
        console.log('REST API endpoints are disabled');
        return;
    }
    const restHandler = new RESTEndpointHandler({
        includeEntities: config.includeEntities ? config.includeEntities.map(e => e.toLowerCase()) : undefined,
        excludeEntities: config.excludeEntities ? config.excludeEntities.map(e => e.toLowerCase()) : undefined,
        includeSchemas: config.includeSchemas ? config.includeSchemas.map(s => s.toLowerCase()) : undefined,
        excludeSchemas: config.excludeSchemas ? config.excludeSchemas.map(s => s.toLowerCase()) : undefined
    });
    const basePath = ___REST_API_BASE_PATH;
    if (authMiddleware) {
        app.use(basePath, authMiddleware, restHandler.getRouter());
    }
    else {
        app.use(basePath, restHandler.getRouter());
    }
    console.log(`REST API endpoints have been set up at ${basePath}`);
}
//# sourceMappingURL=setupRESTEndpoints.js.map