import type { SourceFormat } from "./editor";
/**
 * Every structural element in a PreTeXt project — book, article, chapter,
 * section, worksheet, etc. — is a `Division`.  Divisions are stored as a flat
 * pool of records on the host (Rails) side; hierarchy is expressed by
 * embedding `<plus:division ref="xml-id"/>` placeholder tags inside a parent
 * division's `content`.
 *
 * Type-specific aliases (`<plus:chapter ref="..."/>`, `<plus:section ref="..."/>`)
 * are accepted by the editor as equivalent to `<plus:division ref="..."/>`.
 *
 * Root divisions (type `"book"`, `"article"`, or `"slideshow"`) are the entry
 * point for building the tree.  Non-root divisions whose `xmlId` does not
 * appear in any other division's ref placeholders are considered *orphaned* and
 * are shown separately in the TOC so they can be placed.
 *
 * `"latex"` and `"markdown"` divisions are always leaf nodes for now — they
 * cannot contain child ref placeholders.  Syntax for embedded refs in those
 * formats will be added in a future release.
 */
/**
 * The PreTeXt element type of a division.  Values match the XML tag name so
 * the type can be used directly when serialising (`<${type}>…</${type}>`).
 */
export type DivisionType = "book" | "article" | "slideshow" | "part" | "chapter" | "section" | "introduction" | "conclusion" | "worksheet" | "handout" | "exercises" | "references" | "glossary" | "solutions" | "reading-questions";
/**
 * A single division record, as stored in the host database and passed to
 * the editor.
 */
export interface Division {
    /** Stable server-assigned identifier (Rails record id or UUID). */
    id: string;
    /**
     * The `xml:id` attribute value for this division.  Used as the `ref`
     * value in `<plus:division ref="..."/>` placeholders in parent divisions.
     * Must be unique within the project.
     */
    xmlId: string;
    /** Plain-text display title (extracted from `<title>`). */
    title: string;
    /** The PreTeXt element type of this division. */
    type: DivisionType;
    /**
     * The source format of this division's content.
     * Replaces the project-level `sourceFormat` prop; individual divisions
     * may eventually be converted between formats independently.
     */
    sourceFormat: SourceFormat;
    /**
     * The full source string for this division.
     *
     * For PreTeXt divisions this is the complete XML including the outer
     * wrapper element, e.g. `<section xml:id="..."><title>…</title>…</section>`.
     * Parent divisions may include `<plus:division ref="child-id"/>` placeholders
     * where child divisions should be rendered.
     *
     * For LaTeX / Markdown divisions this is raw source; child ref placeholders
     * are not yet supported for these formats.
     */
    content: string;
}
/**
 * @deprecated Use `DivisionType` instead.  This alias will be removed in a
 * future release once all consumers have migrated to the `Division` model.
 */
export type DocumentSectionType = DivisionType;
/**
 * @deprecated Use `Division` instead.  This alias will be removed in a future
 * release once all consumers have migrated to the `Division` model.
 */
export type DocumentSection = Division;
/**
 * @deprecated The chapter/section split no longer exists in the `Division`
 * model — chapters are simply divisions with `type: "chapter"`.  This alias
 * will be removed in a future release.
 */
export interface DocumentChapter {
    id: string;
    title: string;
    xmlId?: string;
    label?: string;
    content?: string;
    sections?: Division[];
}
/**
 * @deprecated The `wrapper` concept has been removed.  Use `Division` records
 * and `<plus:division ref="..."/>` placeholders instead.
 */
export interface DocumentSplitResult {
    wrapper: string;
    sections: Division[];
}
