using AIStudio.Tools.Mail; using MailKit; namespace AIStudio.Tools.Services.Indexing; /// /// One attachment of a mail as a sync read it. /// /// The attachment, from the structure of the mail. /// Its file name, filtered for prompt injections, or empty when it has none. /// Whether its text was read and, when not, why. /// Its text, which the runtime filtered while reading it. Empty unless the text was read. /// How its text is cut into chunks, by its file type. internal sealed record MailAttachmentText(BodyPartBasic Part, string Name, MailPartTextState TextState, SegmentedText Content, ChunkingStrategy Strategy) { private static readonly SegmentedText NO_TEXT = new(string.Empty, []); /// /// An attachment whose text was not read. /// /// The attachment, from the structure of the mail. /// Its file name, filtered for prompt injections. /// Why its text was not read. public static MailAttachmentText WithoutText(BodyPartBasic part, string name, MailPartTextState textState) => new(part, name, textState, NO_TEXT, TextChunker.DOCUMENT_STRATEGY); }