#pragma once
#include <chrono>
#include <string>
#include <mw/error.hpp>
#include <mw/url.hpp>
/// Contents needed to send one passwordless authentication email.
struct AuthenticationEmail
{
/// Validated recipient address.
std::string recipient;
/// Absolute single-use confirmation URL.
mw::URL confirmation_url;
/// Challenge expiration instant.
std::chrono::system_clock::time_point expires_at;
};
/// Configured delivery mechanism for passwordless authentication links.
class EmailSenderInterface
{
public:
virtual ~EmailSenderInterface() = default;
/// Deliver one authentication link or return a non-secret error.
virtual mw::E<void> send(const AuthenticationEmail& email) = 0;
/// Return whether sends must reserve the global production quota.
virtual bool usesGlobalQuota() const = 0;
};