import edge from 'edge.js';
import { isFunction } from '../../lib/utils.js';
import { AKEmailService } from './email_service.js';
export default class AKEmailProvider {
    app;
    constructor(app) {
        this.app = app;
    }
    register() {
        const config = this.app.config.get('akago_email', {});
        this.app.container.singleton('akago.email.service', async () => new AKEmailService(config));
        const templates = isFunction(config.templates) ? config.templates() : config.templates;
        if (templates)
            edge.mount(AKEmailService.edgeDriveKey, templates);
        if (config.globals)
            Object.keys(config.globals).forEach((key) => edge.global(key, config.globals[key]));
    }
}
//# sourceMappingURL=email_provider.js.map