export interface PaginatedResponse { data: T[] pagination: { page: number; page_size: number; total?: number } } export interface Recipient { name: string address: string } export interface ApiMessageSummary { id: string message_id: string thread_id?: string account_id: string subject: string from: Recipient[] to: Recipient[] date: string snippet: string flags: string[] labels: string[] has_attachments: boolean } export interface ApiMessageFull extends ApiMessageSummary { cc?: Recipient[] body_text?: string body_html?: string in_reply_to?: string references?: string } export interface ApiMailAccount { id: string name: string email: string provider: string imap_host: string smtp_host: string is_active: boolean last_sync_at?: string created_at: string } export interface ApiOutboxMessage { id: string account_id: string status: 'draft' | 'queued' | 'scheduled' | 'sending' | 'sent' | 'failed' | 'cancelled' to: Recipient[] cc?: Recipient[] bcc?: Recipient[] subject: string body_html: string scheduled_at?: string created_at: string } export interface MessageSearchFilter { q?: string from?: string label?: string account_id?: string date_from?: string date_to?: string has_attachment?: boolean } export interface ApiContact { uid: string full_name: string email?: string phone?: string org?: string path?: string etag?: string raw_vcard?: string } export interface ApiContactSyncResponse { sync_token: string contacts: ApiContact[] deleted: string[] } export interface ApiFolder { id: string account_id: string name: string remote_name: string folder_type: 'inbox' | 'sent' | 'drafts' | 'trash' | 'archive' | 'spam' | 'custom' message_count: number unread_count: number } export interface ApiLabel { id: string name: string color: string created_at: string } export interface ApiIdentity { id: string account_id: string email: string name: string is_default: boolean signature_html?: string reply_to_addrs?: string[] } export type WsEventType = 'mail.created' | 'mail.updated' | 'mail.deleted' | 'outbox.updated' | 'contact.updated' export interface WsEvent { type: WsEventType seq: number account_id?: string message_id?: string data?: unknown } export interface ApiError { code: string message: string details?: unknown }