#pragma once
#include <memory>
#include <string>
#include <mw/error.hpp>
#include <mw/http_client.hpp>
#include "email_sender.h"
/// Production authentication email sender using Mailjet Send API v3.1.
class MailjetEmailSender final : public EmailSenderInterface
{
public:
/// Adopt an HTTP session and copy configured sender credentials.
MailjetEmailSender(
std::unique_ptr<mw::HTTPSessionInterface> session,
std::string from_address,
std::string from_name,
std::string api_key,
std::string secret_key);
/// Apply HTTPS-only, redirect, size, and timeout restrictions.
mw::E<void> configure();
/// Deliver one authentication message through Mailjet.
mw::E<void> send(const AuthenticationEmail& email) override;
/// Mailjet calls consume the persistent global quota.
bool usesGlobalQuota() const override;
private:
std::unique_ptr<mw::HTTPSessionInterface> session_;
std::string from_address_;
std::string from_name_;
std::string api_key_;
std::string secret_key_;
};