/**
 * Shared types for the flat, section-based Page Editor model.
 *
 * A page is an ordered list of `PageSection`s stored in a page document's
 * `data.sections` JSON field. A section's `sectionType` keys into the
 * {@link SECTION_TYPES} registry, which is the single source of truth for:
 *   - the Add Section gallery (label / icon / description / category)
 *   - default content + settings when a section is created
 *   - the inspector field schema (which content controls to render)
 *   - the renderer component (dispatches on the same `sectionType` key)
 *   - server + MCP validation of AI-authored section content
 *
 * This module lives in `cms-core` (not `cms-admin`) so the admin editor,
 * the REST API, and the MCP server all validate against ONE definition.
 *
 * NOTE: this is deliberately distinct from the page-builder *tree* model
 * (`SectionNode` etc. in `../page-builder`). That model is a recursive
 * node tree; this one is a flat list of named, schema-driven sections.
 */
/**
 * Stable ids for the built-in section types.
 *
 * The first group is shared (usable on both pages and posts); the second
 * group is post-oriented (article body, pull quote, author bio, related
 * posts, image gallery). Which types appear in a given editor is governed
 * by {@link SectionTypeDef.scope}.
 */
export type SectionTypeId = 'hero' | 'text' | 'feature' | 'stats' | 'cta' | 'form' | 'article-body' | 'quote' | 'author-bio' | 'related-posts' | 'gallery';
/** Where a section type may be used. Drives the Add Section gallery filter. */
export type SectionScope = 'page' | 'post';
/** Field kinds the inspector + validator understand. */
export type SectionFieldType = 'text' | 'textarea' | 'richText' | 'url' | 'media' | 'select' | 'boolean' | 'color' | 'relationship' | 'repeater' | 'stats' | 'gallery';
export interface SectionFieldDef {
    /** key into `PageSection.content` */
    key: string;
    label: string;
    type: SectionFieldType;
    placeholder?: string;
    /** options for `type: 'select'` */
    options?: Array<{
        label: string;
        value: string;
    }>;
    /** collection slug a `relationship` field points at (defaults to the host post type) */
    relationTo?: string;
    /** marks the field required for publish-time validation */
    required?: boolean;
    help?: string;
    /**
     * Sub-field schema for `type: 'repeater'`. Each row of the stored array is an
     * object keyed by these sub-fields. Sub-fields use the same {@link SectionFieldDef}
     * shape (so a row can contain text, media, select, boolean, etc.).
     */
    fields?: SectionFieldDef[];
    /** Singular noun for a repeater row in the editor (e.g. "Plan", "Tier"). Defaults to "Item". */
    rowLabel?: string;
    /** Minimum rows a repeater should have (advisory, surfaced as a warning). */
    minRows?: number;
    /** Maximum rows a repeater allows (the editor disables "Add" at the cap). */
    maxRows?: number;
}
export interface SectionSettings {
    backgroundType?: 'none' | 'solid' | 'gradient';
    backgroundColor?: string;
    paddingY?: 'sm' | 'md' | 'lg' | 'xl';
    anchorId?: string;
    cssClass?: string;
}
export interface SectionTypeDef {
    id: SectionTypeId;
    /** Display name used in the Sections panel + Add gallery */
    name: string;
    /** lucide-react icon name (resolved by the admin panel/gallery) */
    icon: string;
    description: string;
    category: 'layout' | 'content' | 'media' | 'conversion';
    /** accent color key (maps to the shared badge palette) */
    accent: 'purple' | 'green' | 'orange' | 'blue' | 'pink';
    /** which editors expose this type. Defaults (when omitted) to page-only. */
    scope: SectionScope[];
    defaultContent: Record<string, unknown>;
    defaultSettings: SectionSettings;
    /** content fields shown in the inspector, in order */
    fields: SectionFieldDef[];
}
/**
 * A single section on a page. Persisted in `data.sections[]`.
 *
 * `sectionType` is a free string (not the built-in {@link SectionTypeId}
 * union) because a page may carry config-declared custom types
 * (see {@link CustomSectionTypeInput}) or sections authored entirely outside
 * the editor (seed/code-owned). The latter are flagged {@link unmanaged} so
 * the editor preserves them on save and shows them read-only.
 */
export interface PageSection {
    id: string;
    sectionType: string;
    /** Editor-facing display name (defaults to the type name). */
    name: string;
    /** Optional internal-only label for the team. */
    internalLabel?: string;
    visible: boolean;
    content: Record<string, unknown>;
    settings: SectionSettings;
    /**
     * True when this section's `sectionType` has no registered definition
     * (neither a built-in nor a config-declared custom type). Such sections are
     * preserved verbatim through read/save and rendered read-only in the editor
     * so externally-managed content is never silently dropped.
     */
    unmanaged?: boolean;
}
/**
 * Serializable shape a consumer declares in `actuate.config.ts` under
 * `sections.types` to teach the CMS about a custom section type.
 *
 * It is the JSON-safe subset of {@link SectionTypeDef} (no React renderer —
 * the public site registers that separately via `registerSectionRenderer`
 * from `@actuate-media/sections-react`). `registerSectionTypes` fills in any
 * omitted presentation fields with sensible defaults so the Add Section
 * gallery and the field-driven inspector work without extra config.
 */
export interface CustomSectionTypeInput {
    id: string;
    name: string;
    scope: SectionScope[];
    fields: SectionFieldDef[];
    icon?: string;
    description?: string;
    category?: SectionTypeDef['category'];
    accent?: SectionTypeDef['accent'];
    defaultContent?: Record<string, unknown>;
    defaultSettings?: SectionSettings;
}
/** Site-wide section configuration declared on `ActuateCMSConfig.sections`. */
export interface SectionsConfig {
    /**
     * Custom section types recognized + made editable in the admin editor.
     * Canonical key — declared in `actuate.config.ts` under `sections.types`.
     * The public site registers the matching renderer separately via
     * `registerSectionRenderer` from `@actuate-media/sections-react`.
     */
    types?: CustomSectionTypeInput[];
    /**
     * @deprecated Back-compat alias for {@link types}. Prefer `sections.types`.
     * When `types` is present it wins and this is ignored; otherwise this is
     * used so configs written before the rename keep working.
     */
    customTypes?: CustomSectionTypeInput[];
}
/** A structured validation finding for a single section. */
export interface SectionValidationIssue {
    /** the section type the issue belongs to */
    sectionType: string;
    /** content field key when the issue is field-scoped */
    field?: string;
    message: string;
}
export interface SectionValidationResult {
    valid: boolean;
    errors: SectionValidationIssue[];
    warnings: SectionValidationIssue[];
}
/**
 * Design-driven header layout for a post type. These are presentation
 * toggles only — the actual values (title, image, author, date) come from
 * each post document's own fields, never from the template.
 */
export interface PostHeaderConfig {
    /** Overall header composition. */
    layout: 'centered' | 'left' | 'overlay';
    showFeaturedImage: boolean;
    showExcerpt: boolean;
    showAuthor: boolean;
    showDate: boolean;
    showCategory: boolean;
    showReadingTime: boolean;
}
/**
 * A post type's editable template: the header layout plus the ordered list
 * of sections new posts of that type inherit. Stored as a single document
 * per post type in the hidden `post-templates` collection
 * (`data: { postType, header, sections }`).
 */
export interface PostTemplate {
    /** slug of the post-type collection this template belongs to */
    postType: string;
    header: PostHeaderConfig;
    /** default body/trailing sections new posts inherit */
    sections: PageSection[];
}
//# sourceMappingURL=types.d.ts.map