import type { Component } from 'vue';
import type { Schema, Effect } from 'effect';
import type { ColumnDef } from '@tanstack/vue-table';
import type { Environment } from '../../../vendor/cel-js/lib/index.js';
import type { LocaleValue } from '../../../share/locale.js';
type CelEvaluator = <T>(expression: string, context?: Record<string, unknown>) => Effect.Effect<T, any>;
type AnySchema = Schema.Schema<any, any, never>;
type SchemaFactory = (configure: (env: Environment) => void) => AnySchema;
export type ColumnMetadata = Readonly<{
    name: string;
    icon: string;
    /**
     * True when this column publishes its resolved option to the per-row
     * `selections` registry (its runtime keyed by `column.id`). Set it together
     * with the runtime publish so the expression editor never advertises a column
     * that writes nothing. Mirrors `FieldMetadata.selection` on the form host.
     */
    selection?: boolean;
}>;
export type ColumnDefDeps = Readonly<{
    getLocaleText: (value: LocaleValue | undefined) => string | undefined;
    $cel: CelEvaluator;
    inheritedContext: Record<string, unknown>;
}>;
type ToColumnDef = (value: any, deps: ColumnDefDeps) => Partial<ColumnDef<unknown, unknown>>;
/**
 * Capabilities a column-migration function may need from the host. Mirrors
 * the form host's `MigrationContext` so cross-host helpers can share a
 * signature; extend additively rather than introducing a parallel context.
 */
export type MigrationContext = Readonly<{
    $cel: <T>(expression: string, context?: Record<string, unknown>) => Effect.Effect<T, unknown>;
}>;
/**
 * Migrates a value of a *source* column schema to this entry's schema. Lives
 * on the *target* (newer) entry. The target is picked by one of two rules:
 * (a) same `type` with a strictly newer `compatibilityDate`; (b) an explicit
 * `migrateFrom` declaration on the target naming this source. Failures
 * surface to the host as a toast — see `table/config.vue`'s migrate handler.
 */
export type MigrateFn = (prev: unknown, ctx: MigrationContext) => Effect.Effect<unknown, Error>;
/**
 * Identifies a column entry by `(type, compatibilityDate)`. Used for both
 * `migrateFrom` declarations and the cross-type form of `supersededBy`.
 *
 * Migration declarations only ever live on the *new* (target) code — old
 * folders are never modified to announce that they have been superseded.
 */
export type MigrateSource = Readonly<{
    type: string;
    compatibilityDate: string;
}>;
/**
 * Optional creation-time defaults factory. Returns a partial config that
 * merges into the seed when the user adds a new column, so newly-added
 * columns arrive with their required fields populated. Schemas remain pure
 * validators — defaults live next to them. Mirrors `FieldDefaults` in the
 * form host's `resolve.ts`.
 */
export type ColumnDefaults = () => Record<string, any>;
export type ColumnEntry = Readonly<{
    type: string;
    compatibilityDate: string;
    metadata: ColumnMetadata;
    schema: SchemaFactory;
    config: Component;
    runtime: Component;
    toColumnDef: ToColumnDef;
    /**
     * True iff this entry is shadowed by either (a) a newer-date entry sharing
     * its `type`, or (b) another entry whose `migrateFrom` names this one.
     */
    deprecated: boolean;
    /**
     * Identifies the entry that supersedes this one. Same `type` for the
     * date-versioned rule; a different `type` for declared cross-type
     * migrations.
     */
    supersededBy?: MigrateSource;
    migrate?: MigrateFn;
    migrateFrom?: ReadonlyArray<MigrateSource>;
    /**
     * Optional creation-time defaults. The host merges the returned partial
     * onto the seed when the user adds a new column via the picker. Absent →
     * the column is created with only `{ id, type, compatibilityDate }`.
     */
    defaults?: ColumnDefaults;
}>;
export declare const COLUMNS: ReadonlyArray<ColumnEntry>;
export declare function allColumnSchemas(configure: (env: Environment) => void): ReadonlyArray<AnySchema>;
export declare function findColumn(type: string, compatibilityDate: string): ColumnEntry | undefined;
/**
 * Finds the registry entry that has declared `(type, compatibilityDate)` as a
 * migration source on its `migrateFrom`. Use when a stored column's identity
 * no longer matches any registry entry (the old folder was renamed away) —
 * a present return means the value is still migratable via the target's
 * `migrate`.
 *
 * Note: for the date-versioned rule (same `type`, newer `compatibilityDate`)
 * the entry itself is in the registry and tagged `deprecated`/`supersededBy`;
 * callers reach the target through `findColumn(supersededBy.type, …)`
 * rather than this function.
 */
export declare function findMigrationTarget(type: string, compatibilityDate: string): ColumnEntry | undefined;
export declare function latestColumnByType(): ReadonlyArray<ColumnEntry>;
export {};
