Class MailDocumentBlock
- Namespace
- MailFathom.Application.EmailContent.Rendering.Document
- Assembly
- MailFathom.Application.dll
One typed part of a reduced mail body.
[JsonPolymorphic(TypeDiscriminatorPropertyName = "type")]
[JsonDerivedType(typeof(MailParagraphBlock), "paragraph")]
[JsonDerivedType(typeof(MailHeadingBlock), "heading")]
[JsonDerivedType(typeof(MailListBlock), "list")]
[JsonDerivedType(typeof(MailTableBlock), "table")]
[JsonDerivedType(typeof(MailQuoteBlock), "quote")]
[JsonDerivedType(typeof(MailImageBlock), "image")]
[JsonDerivedType(typeof(MailSeparatorBlock), "separator")]
[JsonDerivedType(typeof(MailPreformattedBlock), "preformatted")]
public abstract record MailDocumentBlock : IEquatable<MailDocumentBlock>
- Inheritance
-
MailDocumentBlock
- Implements
- Derived
- Inherited Members
Remarks
The hierarchy is closed by a private protected constructor, so the eight derived types declared beside it are the whole of it: nothing outside this assembly can bring a block into being from data. What C# leaves reachable is the copy constructor every non-sealed record has and which the language requires to be protected — a type derived through it can only copy a block this assembly already composed, carries that block's catalogue type, and is refused by the serializer as a derived type the contract never declared.
That closure is the isolation statement of the default rendering path. A client receives no markup and runs no engine, so script cannot run because nothing that could run it is on this path, and message style cannot escape the pane because no member anywhere below offsets a node, transforms it, floats it, gives it an absolute size, or orders it in front of anything. A width survives only as a share of the parent it sits in, which cannot resolve to a position outside that parent. Admitting a positional or absolute-dimensional property here is what would break that, and this is where it would have to be argued.
Every block carries the version of its own type, taken from the catalogue rather than supplied by whatever composed the document: a client meeting a version it does not know refuses that block and renders the rest of the message, and a producer cannot claim a revision it did not write.
Properties
- Type
Gets which of the catalogued blocks this is.
- Version
Gets the revision of this block's contract, which is the catalogue's rather than the producer's.