namespace AIStudio.Tools.Mail;
///
/// One mail as text, the way AI Studio indexes it and a model gets to read it.
///
/// The lines written above the text: who wrote to whom, when, and about what.
/// The text of the mail, empty when it is encrypted or has none.
/// The subject on one line, empty when the mail has none.
/// How the content is encrypted, NONE when it is readable.
/// How important the sender marked the mail.
/// Which part of the mail the text was read from.
public sealed record MailText(string HeaderBlock, string Body, string Subject, MailEncryptionKind EncryptionKind, MailImportance Importance, MailBodySource BodySource)
{
///
/// The header block and the text together, which is what gets cut into chunks: the first
/// chunk starts with the header block, so a search for a sender or a subject finds the mail.
///
public string FullText => this.Body.Length is 0 ? this.HeaderBlock : $"{this.HeaderBlock}\n\n{this.Body}";
}