<?php

use function DI\autowire, DI\create, DI\get;

use TheBugs\Email\EmailConfiguration,
    TheBugs\Email\MailerInterface,
    TheBugs\Email\SwiftMailer;

return [
    EmailConfiguration::class => function($c) {
        $email = new EmailConfiguration( EmailConfiguration::AUTH_TYPE_SMTP );
        $email->smtpHost = getenv('SMTP_HOST');
        $email->smtpPort = getenv('SMTP_PORT');
        $email->smtpUsername = getenv('SMTP_USERNAME');
        $email->smtpPassword = getenv('SMTP_PASSWORD');
        $email->smtpUseTLS = getenv('SMTP_TLS');
        $email->toAddress = getenv("TO_EMAIL");
        $email->fromAddress = getenv("FROM_EMAIL");
        $email->fromName = getenv("FROM_NAME");
        return $email;
    },

    MailerInterface::class => autowire(SwiftMailer::class),
];