···3333 cards: DeckCard[];
3434};
35353636+/** Primer can be embedded document, external URI, or reference to another record */
3737+export type Primer = Deck["primer"];
3838+3939+import type { Document } from "./lexicons/types/com/deckbelcher/richtext";
4040+4141+const EMBEDDED_PRIMER_TYPE = "com.deckbelcher.richtext#document" as const;
4242+4343+/** Extract embedded document from primer union, if present */
4444+export function getEmbeddedPrimer(primer: Primer): Document | undefined {
4545+ if (!primer) return undefined;
4646+ if (primer.$type === EMBEDDED_PRIMER_TYPE) return primer;
4747+ return undefined;
4848+}
4949+5050+/** Wrap a document as an embedded primer for saving */
5151+export function toEmbeddedPrimer(doc: Document): Primer {
5252+ return { ...doc, $type: EMBEDDED_PRIMER_TYPE };
5353+}
5454+3655/**
3756 * View configuration for deck display
3857 */
···1919 format?: string;
20202121 /** Deck primer with strategy, combos, and card choices. */
2222- primer?: com.deckbelcher.richtext.Document;
2222+ primer?: Primer;
23232424 /** Array of cards in the decklist. */
2525 @required
···31313232 /** Timestamp when the decklist was last updated. */
3333 updatedAt?: datetime;
3434+ }
3535+3636+ /** Primer content - inline, external URI, or linked record. */
3737+ @inline
3838+ union Primer {
3939+ embedded: com.deckbelcher.richtext.Document,
4040+ uri: PrimerUri,
4141+ ref: PrimerRef,
4242+ unknown,
4343+ }
4444+4545+ /** External primer content. Typically a URL, but any valid URI scheme. */
4646+ model PrimerUri {
4747+ @required
4848+ @format("uri")
4949+ @maxLength(10000)
5050+ @maxGraphemes(1000)
5151+ uri: string;
5252+ }
5353+5454+ /** Primer in a separate ATProto record. For use with any longform writing lexicon. */
5555+ model PrimerRef {
5656+ @required
5757+ ref: com.atproto.repo.strongRef.Main;
3458 }
35593660 /** A tag annotation for a card. */