package com.r35157.service.notification.impl.smtp;

import com.r35157.service.notification.NotificationDestination;
import org.jetbrains.annotations.NotNull;

/**
 * Complete SMTP destination configuration for a bound plain-text
 * notification service.
 *
 * @param emailAddress destination email address
 * @param subject fixed subject for every notification sent to the destination
 */
public record SMTPDestination(
        @NotNull ΩEmailAddressΩ emailAddress,
        @NotNull ΩEmailSubjectΩ subject
) implements NotificationDestination {
    /**
     * Validates the complete SMTP destination binding.
     *
     * @throws IllegalArgumentException if the email address or subject is
     *                                  {@code null}, empty, or blank
     */
    public SMTPDestination {
        if (emailAddress == null || emailAddress.isBlank()) {
            throw new IllegalArgumentException("Email address cannot be blank");
        }
        if (subject == null || subject.isBlank()) {
            throw new IllegalArgumentException("Email subject cannot be blank");
        }
    }
}
