import { z } from "zod/mini" import type { BooleanContent } from "./boolean" import { BooleanContentSchema, BooleanContentType } from "./boolean" import type { EmbedContent } from "./embed" import { EmbedContentSchema, EmbedContentType } from "./embed" import type { EmptyContent } from "./empty" import { EmptyContentSchema, EmptyContentType } from "./empty" import type { ColorContent, DateContent, NumberContent, RangeContent, SelectContent, TextContent, TimestampContent, } from "./field" import { FieldContentType, FieldContentSchema } from "./field" import type { GeoPointContent } from "./geopoint" import { GeoPointContentSchema, GeoPointContentType } from "./geopoint" import type { ImageContent } from "./image" import { ImageContentSchema, ImageContentType } from "./image" import type { IntegrationFieldContent } from "./integrationField" import { IntegrationFieldContentSchema, IntegrationFieldContentType } from "./integrationField" import type { LinkContent } from "./link" import { LinkContentSchema, LinkContentType } from "./link" import type { RepeatableContent } from "./repeatable" import { RepeatableContentSchema, RepeatableContentType } from "./repeatable" import type { RichTextContent } from "./richText" import { RichTextContentSchema, RichTextContentType } from "./richText" import type { SeparatorContent } from "./separator" import { SeparatorContentSchema, SeparatorContentType } from "./separator" import type { TableContent } from "./table" import { TableContentSchema, TableContentType } from "./table" export const NestableContentSchema = z.discriminatedUnion("__TYPE__", [ EmptyContentSchema, BooleanContentSchema, EmbedContentSchema, GeoPointContentSchema, ImageContentSchema, IntegrationFieldContentSchema, LinkContentSchema, RepeatableContentSchema, RichTextContentSchema, SeparatorContentSchema, TableContentSchema, FieldContentSchema, ]) export type NestableContent = | EmptyContent | BooleanContent | ColorContent | DateContent | EmbedContent | GeoPointContent | ImageContent | IntegrationFieldContent | LinkContent | NumberContent | RangeContent | RepeatableContent | RichTextContent | SelectContent | SeparatorContent | TableContent | TextContent | TimestampContent const NestableContentTypes = [ EmptyContentType, BooleanContentType, EmbedContentType, FieldContentType, GeoPointContentType, ImageContentType, IntegrationFieldContentType, LinkContentType, RepeatableContentType, RichTextContentType, SeparatorContentType, TableContentType, ] type NestableContentType = (typeof NestableContentTypes)[number] /** @internal */ export function isNestableContent(content: { __TYPE__: string }): content is { __TYPE__: NestableContentType } { return (NestableContentTypes as string[]).includes(content.__TYPE__) }