import type { EntryEditProps } from 'alinea/dashboard/view/EntryEdit';
import type { ComponentType } from 'react';
import type { EntryStatus } from './Entry.js';
import type { Expr } from './Expr.js';
import { Field } from './Field.js';
import { type HasType } from './Internal.js';
import type { Label } from './Label.js';
import type { OrderBy } from './OrderBy.js';
import type { Preview } from './Preview.js';
import { Section } from './Section.js';
import type { View } from './View.js';
import type { SummaryProps } from './media/Summary.js';
import { RecordShape } from './shape/RecordShape.js';
import type { Expand } from './util/Types.js';
export interface EntryUrlMeta {
    status: EntryStatus;
    path: string;
    parentPaths: Array<string>;
    locale?: string | null;
}
export type Type<Definition = object> = Definition & HasType;
type TypeRow<Definition> = Expand<{
    [K in keyof Definition as Definition[K] extends Expr<any> ? K : never]: Definition[K] extends Expr<infer T> ? T : never;
}>;
export declare namespace Type {
    type Infer<Definition> = TypeRow<Definition>;
    function label(type: Type): Label;
    function contains(type: Type): Array<string | Type>;
    function insertOrder(type: Type): 'first' | 'last' | 'free';
    function isHidden(type: Type): boolean;
    function shape(type: Type): RecordShape;
    function searchableText(type: Type, value: any): string;
    function sections(type: Type): Section[];
    function isContainer(type: Type): boolean;
    function field(type: Type, name: string): Field | undefined;
    function isType(type: any): type is Type;
    function sharedData(type: Type, entryData: Record<string, unknown>): Record<string, unknown> | undefined;
    function initialValue(type: Type): Record<string, unknown>;
    function preview(type: Type): Preview | undefined;
    function validate(type: Type): void;
    function referencedViews(type: Type): Array<string>;
}
export interface FieldsDefinition {
    [key: string]: Field;
}
export interface TypeConfig<Definition> {
    fields: Definition;
    /** Accepts entries of these types as children */
    contains?: Array<string | Type>;
    /** Order children entries in the sidebar content tree */
    orderChildrenBy?: OrderBy | Array<OrderBy>;
    /** Entries do not show up in the sidebar content tree */
    hidden?: true;
    /** An icon (React component) to represent this type in the dashboard */
    icon?: ComponentType;
    /** A React component used to view an entry of this type in the dashboard */
    view?: View<EntryEditProps & {
        type: Type;
    }>;
    /** A React component used to view a row of this type in the dashboard */
    summaryRow?: View<SummaryProps>;
    /** A React component used to view a thumbnail of this type in the dashboard */
    summaryThumb?: View<SummaryProps>;
    /** The position where new children will be inserted */
    insertOrder?: 'first' | 'last' | 'free';
    entryUrl?: (meta: EntryUrlMeta) => string;
    preview?: Preview;
}
export interface TypeInternal extends TypeConfig<FieldsDefinition> {
    label: string;
    allFields: Record<string, Field>;
    sections: Array<Section>;
    shape: RecordShape;
}
/** Create a new type */
export declare function type<Fields extends FieldsDefinition>(label: string, config: TypeConfig<Fields>): Type<Fields>;
export {};
