import { Logger } from '@adonisjs/core/logger';
import { PgBoss } from '@akago/adonisjs-pg-boss/provider';
import { defaultChannels } from './channel.js';
import { AKEventService } from './event_service.js';
export default class AKEventServiceProvider {
    app;
    constructor(app) {
        this.app = app;
    }
    register() {
        this.app.container.singleton(AKEventService, async (resolver) => {
            const config = this.app.config.get('akago_event');
            const userServiceClass = await config.userServiceClass.resolver(this.app);
            const channels = {
                ...defaultChannels(config.eventTypesPreferenciablePerUser),
                ...config.channels,
            };
            return new AKEventService(await resolver.make(PgBoss), await resolver.make(userServiceClass), await resolver.make(Logger), channels);
        });
        this.app.container.alias('akago.event.service', AKEventService);
    }
    async boot() {
        const eventService = await this.app.container.make('akago.event.service');
        await eventService.init();
    }
}
//# sourceMappingURL=event_service_provider.js.map