import type { IUnifiedEmailServerOptions } from '@push.rocks/smartmta'; /** Outbound SMTP egress mode. 'remoteIngress' (default): deliver via RemoteIngress edges only, * no direct-from-hub fallback. 'direct' is an explicit operator opt-out. */ export type TEmailOutboundMode = 'direct' | 'remoteIngress'; /** Readiness of the RemoteIngress outbound egress path — surfaced when outboundMode is 'remoteIngress'. */ export interface IEmailOutboundEgressStatus { ready: boolean; eligibleEdgeCount: number; /** Populated when not ready, e.g. 'no connected mail edge with native QUIC egress'. */ reason?: string; } /** Lifecycle state of the smartmta Rust mailer bridge. 'failed' and 'restarting' mean mail processing is degraded. */ export type TEmailBridgeState = 'idle' | 'starting' | 'running' | 'restarting' | 'failed' | 'stopped'; export interface IEmailPortConfig { /** External to internal SMTP port mapping. */ portMapping?: Record; /** Custom route settings for specific external ports. */ portSettings?: Record; /** Path to store received emails, when configured by the runtime. */ receivedEmailsPath?: string; } export interface IEmailServerSettings { enabled: boolean; hostname: string | null; outboundMode: TEmailOutboundMode; ports: number[]; portMapping: Record | null; receivedEmailsPath: string | null; maxMessageSize: number | null; domainCount: number; routeCount: number; authUserCount: number; /** Operator-managed SMTP submission accounts (hashed credentials, DB-backed). */ smtpAccountCount?: number; /** Present when the email server is running: whether the SMTP listener is accepting connections. */ smtpListenerActive?: boolean; /** Present when outboundMode is 'remoteIngress': whether a mail egress edge is currently available. */ outboundEgress?: IEmailOutboundEgressStatus; /** Present when the email server is running: current state of the Rust mailer bridge. */ mailerBridgeState?: TEmailBridgeState; updatedAt: number; updatedBy: string; } export interface IEmailServerSettingsSeed { enabled?: boolean; outboundMode?: TEmailOutboundMode; emailConfig?: IUnifiedEmailServerOptions; emailPortConfig?: IEmailPortConfig; } export type TEmailServerSettingsUpdate = { enabled?: boolean; hostname?: string | null; outboundMode?: TEmailOutboundMode; ports?: number[]; portMapping?: Record | null; receivedEmailsPath?: string | null; maxMessageSize?: number | null; /** * Exact names of persisted legacy routes to remove (the internal-relay * retirement lever). Fails loudly on unknown names and refuses generated * managed routes ('workapp-mail-*', 'smtp-account-*'). */ removeRouteNames?: string[]; };