import { pluginHost } from '../../core/plugin-host/host.js';
import { dtoSlug } from '../../services/slug.js';
import { dtoSerializer } from './serializer.js';
import { dtoSystemPrompt } from './system-prompt.js';
import { dtosRouter } from './routes.js';
import { DtoService } from './services.js';
import { createDtoToolsServer } from './mcp-server.js';
export const dtoBackendModule = {
    type: 'dto',
    table: 'dto',
    label: 'DTO',
    labelPlural: 'DTOs',
    displayOrder: 20,
    pathPrefix: '/dtos',
    slugFrom: (data) => dtoSlug(data.name),
    serializer: dtoSerializer,
    systemPrompt: dtoSystemPrompt,
    backend: {
        mount(ctx) {
            const service = new DtoService(ctx.db, ctx.tagsService, ctx.versionService);
            ctx.app.use(`/api${dtoBackendModule.pathPrefix}`, dtosRouter(service, ctx.referencesService));
            ctx.registerMcpServer(`${dtoBackendModule.type}-tools`, () => createDtoToolsServer({
                dtoService: service,
                referencesService: ctx.referencesService,
                ws: ctx.ws,
            }));
            ctx.setIdResolver(dtoBackendModule.type, (slug) => service.getIdBySlug(slug));
            ctx.registerEntityService(dtoBackendModule.type, service);
        },
    },
};
pluginHost.registerBackendModule(dtoBackendModule);
//# sourceMappingURL=plugin.js.map