export type EmailSummary = {
  id: string;
  from: string;
  to: string;
  subject: string;
  date: string;
  snippet: string;
  attachmentCount?: number;
  read?: boolean;
  fromDomain?: string;
  labels?: string[];
  // Conversation grouping: total messages in the thread, and how many are unread (folder view only).
  threadCount?: number;
  threadUnread?: number;
};

export type EmailMessage = EmailSummary & {
  cc?: string;
  html?: string;
  text?: string;
  attachments: Array<{ filename: string; size: number; contentType: string }>;
};

// A full conversation: every non-deleted message in the thread, oldest first.
export type EmailThread = {
  id: string; // the representative message id used to open the thread
  subject: string;
  messages: EmailMessage[];
};
