import { apiRequest } from './api'; export type SmtpSecurityMode = 'NONE' | 'STARTTLS' | 'TLS'; export interface PublicSmtpSettings { source: 'DATABASE' | 'ENVIRONMENT' | 'NONE'; id?: string; host?: string; port?: number; securityMode?: SmtpSecurityMode; username?: string | null; hasPassword?: boolean; fromName?: string | null; fromEmail?: string; replyTo?: string | null; enabled: boolean; updatedAt?: string; } export function getSmtpSettings() { return apiRequest('/document-delivery/smtp'); } export function saveSmtpSettings(input: { host: string; port: number; securityMode: SmtpSecurityMode; username?: string | null; password?: string | null; fromName: string; fromEmail: string; replyTo?: string | null; enabled: boolean; }) { return apiRequest('/document-delivery/smtp', { method: 'PUT', body: JSON.stringify(input), }); } export function testSmtpSettings(email: string) { return apiRequest<{ ok: boolean; recipient: string; messageId: string }>('/document-delivery/smtp/test', { method: 'POST', body: JSON.stringify({ email }), }); }