/**
 * TypeScript + Prisma adapter — the first SpecVerse-vocabulary translator.
 *
 * Reads `schema.prisma` files surfaced by the structural pre-pass and
 * extracts SpecVerse facts:
 *   - Models → entities
 *   - `@relation` declarations → relationships (belongsTo / hasMany)
 *   - enum declarations → lifecycle state candidates (when paired with a
 *     status-typed field on a model)
 *   - Field types + modifiers (@id, @unique, @default) → SpecVerse attributes
 *
 * Why Prisma first: SpecVerse realize emits Prisma in its default backend
 * stack, so every Class 1 corpus case (poll-app, full-stack-template,
 * steps-example) uses Prisma. Prisma's vocabulary is also closer to
 * SpecVerse than other ORMs — minimal semantic translation needed.
 *
 * Adapter responsibilities (per the structural-prepass proposal):
 *   - Consume the StructuralPrepass interface (file listings, source text)
 *   - NOT parse arbitrary code (that's the backend's job — tree-sitter)
 *   - Produce SpecVerse-shaped facts that the analyse prompt can consume
 */
import type { StructuralPrepass } from '../interface.js';
export interface PrismaField {
    name: string;
    type: string;
    required: boolean;
    unique: boolean;
    default?: string;
    /** SpecVerse `auto=` token derived from the default (uuid4 / autoincrement / cuid / now). */
    auto?: string;
    isId: boolean;
    isList: boolean;
}
/**
 * Map a Prisma `@default(...)` expression to a SpecVerse `auto=` token, so
 * id-generation semantics survive analyse (Phase 2 of the identity proposal)
 * instead of being discarded + re-guessed as uuid. Value-literal defaults
 * (`"active"`, `true`, `0`) are NOT id-gen autos → undefined.
 */
export declare function autoFromPrismaDefault(def: string | undefined): string | undefined;
export interface PrismaRelation {
    fromModel: string;
    toModel: string;
    /** belongsTo if the FK lives on this side; hasMany if inverse */
    type: 'belongsTo' | 'hasMany' | 'hasOne';
    cascade: boolean;
    /** The field name carrying the relation (for belongsTo) or the inverse field (for hasMany) */
    fieldName: string;
}
export interface PrismaEntity {
    name: string;
    filePath: string;
    fields: PrismaField[];
    /** Lifecycle state literals from a status field's enum, if detected. */
    lifecycleStates?: string[];
    /** The status field name (if a lifecycle was detected). */
    lifecycleField?: string;
}
export interface PrismaFacts {
    entities: PrismaEntity[];
    relationships: PrismaRelation[];
    /** Enum declarations in source — keyed by name. Used by the lifecycle detector. */
    enums: Record<string, string[]>;
    /** Schema files found. */
    schemaFiles: string[];
    /** Raw `datasource { provider = … }` value (postgresql / sqlite / mongodb / …), or null. */
    datasourceProvider: string | null;
    /**
     * Storage profile derived from the datasource provider, for the
     * deployment-emitter (so a Prisma app emits a faithful storage `type`
     * instead of the blanket `document` default). null when no datasource
     * provider was found.
     */
    storageProfile: {
        type: 'relational' | 'document';
        provider: string;
    } | null;
}
/**
 * Map a Prisma datasource provider to a SpecVerse storage profile.
 * Prisma's SQL providers (postgresql / mysql / sqlite / sqlserver /
 * cockroachdb) are `relational`; `mongodb` is `document`. `postgres` is
 * normalised to `postgresql`. Exported for direct unit testing of the
 * mapping (incl. the Mongo branch) without a fixture per provider.
 */
export declare function storageProfileForPrismaProvider(provider: string): {
    type: 'relational' | 'document';
    provider: string;
};
/**
 * Run the Prisma adapter against a structural pre-pass.
 *
 * The adapter relies on `prepass.fileSourceText()` to read schema.prisma
 * directly — it doesn't need any of the backend's call-graph or symbol
 * indexing for Prisma extraction. Prisma's schema syntax is small enough
 * that regex over the raw text is the right tool.
 *
 * Discovers Prisma sources via `**\/*.prisma` to cover both layouts:
 *   - Single-file: `schema.prisma` (the legacy default).
 *   - Multi-file: Prisma 5.18+ `prismaSchemaFolder` previewFeature, where
 *     models split across `prisma/schema/*.prisma`.
 * Files lacking model/enum declarations (e.g. files containing only
 * `generator` + `datasource` blocks) contribute nothing and are harmless.
 * Duplicate model names across files emit a warning and the FIRST
 * declaration wins (Prisma itself rejects duplicates at validate-time).
 */
export declare function extractTypeScriptPrisma(prepass: StructuralPrepass): Promise<PrismaFacts>;
//# sourceMappingURL=typescript-prisma.d.ts.map