/**
 * TypeScript + Drizzle adapter — ORM-schema source-of-truth for Drizzle ORM.
 *
 * Reads Drizzle table declarations (`pgTable` / `sqliteTable` / `mysqlTable`
 * from `drizzle-orm/*-core`) surfaced by the structural pre-pass and extracts
 * SpecVerse facts, the same way `typescript-prisma.ts` reads `schema.prisma`:
 *   - `pgTable("name", { ...columns })` → entity (named from the export const)
 *   - column type functions (`text`/`integer`/`boolean`/`timestamp`/`jsonb`/…)
 *     → typed SpecVerse attributes
 *   - `.notNull()` → required, `.primaryKey()` → id, `.unique()` → unique,
 *     `.default(...)` / `.defaultNow()` → default
 *   - `.references(() => other.col, { onDelete })` → belongsTo (+ inverse
 *     hasMany; cascade propagated from `onDelete: "cascade"`)
 *   - `pgEnum("name", [...])` referenced by a column → lifecycle candidate
 *
 * Why this matters: Drizzle + Postgres (Neon/Express) is one of the most common
 * TypeScript backend stacks, but without this adapter analyse falls through to
 * the typescript-interfaces class-walker, which promotes service/utility
 * CLASSES (scrapers, managers) to entities and loses the real ORM tables +
 * their column types. This adapter is the high-precision source the orchestrator
 * runs ahead of the class-walker (which is then suppressed from minting entities
 * — see analyse-prepass/index.ts).
 *
 * Adapter responsibilities (per the structural-prepass proposal): consume the
 * StructuralPrepass interface (file listings + source text), do NOT parse
 * arbitrary code — regex + a small balanced-brace scanner over the schema
 * file's raw text, which is all Drizzle's declaration syntax needs.
 */
import type { StructuralPrepass } from '../interface.js';
export interface DrizzleField {
    name: string;
    /** SpecVerse-vocabulary type (String / Integer / Boolean / DateTime / Json / …). */
    type: string;
    required: boolean;
    unique: boolean;
    default?: string;
    /** SpecVerse `auto=` token (autoincrement / uuid4 / now) — id-gen semantics (Phase 2). */
    auto?: string;
    isId: boolean;
}
export interface DrizzleRelation {
    fromModel: string;
    toModel: string;
    type: 'belongsTo' | 'hasMany' | 'hasOne';
    cascade: boolean;
    /** The FK column carrying the relation (for belongsTo). */
    fieldName: string;
}
export interface DrizzleEntity {
    name: string;
    filePath: string;
    fields: DrizzleField[];
    lifecycleStates?: string[];
    lifecycleField?: string;
}
export interface DrizzleFacts {
    entities: DrizzleEntity[];
    relationships: DrizzleRelation[];
    enums: Record<string, string[]>;
    schemaFiles: string[];
    /** SQL dialect detected from the table function / config. */
    dialect: 'postgresql' | 'mysql' | 'sqlite' | null;
}
/**
 * Run the Drizzle adapter against a structural pre-pass.
 *
 * Discovers schema files by reading any `drizzle.config.*` for its `schema:`
 * path(s), unioned with common Drizzle layout globs (`**\/schema.ts`,
 * `**\/schema\/**\/*.ts`, `**\/db\/schema*.ts`). Candidate files are then
 * content-filtered to those declaring a Drizzle table — so an unrelated
 * `schema.ts` (e.g. a Zod schema module) contributes nothing.
 */
export declare function extractTypeScriptDrizzle(prepass: StructuralPrepass): Promise<DrizzleFacts>;
//# sourceMappingURL=typescript-drizzle.d.ts.map