/** * Standardized Email Interfaces * * This file contains the core interfaces for email data structures * used throughout the application. All components should use these * interfaces for consistency. */ export interface EmailAddress { name: string; address: string; } export interface EmailAttachment { filename: string; contentType: string; content?: string; size?: number; contentId?: string; } /** * Standard email content structure used throughout the application * Ensures consistent handling of HTML/text content and text direction */ export interface EmailContent { /** Plain text version of the content (always required) */ text: string; /** HTML version of the content (optional) */ html?: string; /** Whether the primary display format should be HTML */ isHtml: boolean; /** * Text direction - 'rtl' for right-to-left languages (Arabic, Hebrew, etc.) * or 'ltr' for left-to-right languages (default) */ direction: 'ltr' | 'rtl'; } export interface EmailFlags { seen: boolean; flagged: boolean; answered: boolean; deleted: boolean; draft: boolean; } export interface EmailMessage { id: string; subject: string; from: string; to: string; cc?: string; bcc?: string; date: string; flags: string[]; content: EmailContent; attachments?: Array<{ filename: string; contentType: string; encoding?: string; content?: string; }>; // For debugging and transition _originalFormat?: any; } // This represents the legacy email format that might come from API export interface LegacyEmailMessage { id: string; subject: string; from: string; to: string; cc?: string; bcc?: string; date: string; flags?: string[] | Record; content?: string | EmailContent; html?: string; // Some APIs provide HTML directly text?: string; // Some APIs provide text directly plainText?: string; // Alternative to text formattedContent?: string; // Legacy property attachments?: Array<{ filename?: string; name?: string; contentType?: string; content?: string; }>; }