import app from '@adonisjs/core/services/app';
import { AKAuthContext } from './auth_context.js';
export default class AKAuthContextProvider {
    app;
    constructor(app) {
        this.app = app;
    }
    register() {
        this.app.container.singleton('akago.auth.context', async (resolver) => {
            const config = app.config.get('akago_auth');
            const userServiceClass = await config.userServiceClass.resolver(this.app);
            const userService = await resolver.make(userServiceClass);
            return new AKAuthContext((id) => userService.findById(id));
        });
    }
}
export let authContext;
await app.booted(async () => {
    authContext = await app.container.make('akago.auth.context');
});
//# sourceMappingURL=provider.js.map