/**
 * Core domain types for the code generator. Describes the input (module schema loaded from
 * `{bc}.aurora.yaml`) and intermediate representations used while rendering templates.
 * Types here have no behaviour — helpers live in sibling files (`property-*.ts`, `utils/code-gen.ts`).
 */
/**
 * Logical type of a domain property. Drives Sequelize types, GraphQL scalars,
 * DTO types, Swagger decorators, mocking strategy, and the SQL column shape.
 */
export type PropertyType = 'array' | 'bigint' | 'blob' | 'blob.long' | 'blob.medium' | 'blob.tiny' | 'boolean' | 'char' | 'date' | 'decimal' | 'encrypted' | 'enum' | 'float' | 'id' | 'int' | 'json' | 'jsonb' | 'password' | 'relationship' | 'smallint' | 'text' | 'timestamp' | 'varchar';
/** Database index kind: non-unique (`index`) or unique (`unique`). */
export type PropertyIndex = 'index' | 'unique';
/** Grammatical gender of the module's singular noun. See {@link ModuleDefinitionSchema.front}. */
export type Gender = 'feminine' | 'masculine';
/**
 * How the module's detail surface is presented in the UI.
 * - `view` (default): detail lives as a routed page (`/new`, `/edit/:id`).
 * - `dialog`: detail lives inside the list as an `<hlm-dialog>` modal;
 *   no detail component file is emitted.
 *
 * Custom form bodies are supported via the `AURORA:FORM-FIELDS-START/END`
 * preservation region inside `*-form.component.ts`, independent of detailMode.
 */
export type DetailMode = 'dialog' | 'view';
/** PostgreSQL index access method for properties that declare `indexUsing`. */
export type PropertyIndexUsing = 'BRIN' | 'Btree' | 'GIN' | 'GiST' | 'HASH' | 'spgist';
/** Cardinality of a relationship between two aggregates. */
export type RelationshipType = 'many-to-many' | 'many-to-one' | 'none' | 'one-to-many' | 'one-to-one';
/** GraphQL resolver shape for an additional API endpoint. */
export type ResolverType = 'mutation' | 'query';
/** HTTP verb accepted by an additional REST API endpoint. */
export type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
import { WidgetType } from './widget-type.js';
export { WidgetType };
/** Which half of the generated stack a template targets. */
export type Scope = 'back' | 'front';
/** Granularity of a generation step: an entire bounded context or a single module. */
export type ScopeElement = 'bounded-context' | 'module';
/**
 * Identifier of a bundled template tree. Each value points to a directory under
 * `src/templates/codegen/`. Passed to the generator engine's `generateFromTemplate`.
 */
export type TemplateElement = 'backend/@api' | 'backend/@app' | 'backend/additional-@api' | 'backend/application' | 'backend/bounded-context' | 'backend/env' | 'backend/i18n-@app' | 'backend/package' | 'backend/packages' | 'backend/pivot' | 'backend/postman' | 'backend/test' | 'backend/types' | 'backend/value-object' | 'frontend/application' | 'frontend/module' | 'frontend/module-translations' | 'frontend/packages';
/** Options for `array` properties: element type and (when element is `enum`) allowed values. */
export interface PropertyArrayOptions {
    /** Values admitted when the array element is `enum`. */
    enumOptions?: string[];
    length?: number;
    maxLength?: number;
    /** Element type. Usually a primitive or `enum`. */
    type: PropertyType;
}
/**
 * Relationship metadata for properties of type `relationship`. Fully
 * describes how the local aggregate connects to a remote one.
 */
export interface PropertyRelationship {
    /** Target aggregate name. */
    aggregateName: string;
    /** If true, the generated SQL does not add a foreign key constraint. */
    avoidConstraint: boolean;
    /** Field name on the remote aggregate (e.g. the FK column). */
    field: string;
    /** If true, the target column is denormalized into this aggregate. */
    isDenormalized?: boolean;
    /** Local column name when it differs from the property name. */
    key?: string;
    /** Module path of the target aggregate (e.g. `iam/user`). */
    modulePath: string;
    /** External package when the target lives outside the current bounded context. */
    packageName?: string;
    /** Pivot metadata for many-to-many relationships. */
    pivot?: RelationshipPivot;
    /** Singular form of the target name (used for foreign key column naming). */
    singularName?: string;
    type: RelationshipType;
}
/**
 * Frontend widget configuration. Added to a property when the detail/list
 * view should render a specific reusable component.
 */
export interface PropertyWidget {
    /** Ordinal position in the detail form (ascending). */
    detailSort?: number;
    /** Logical group identifier — fields sharing a group render together with a header. */
    group?: string;
    /** If true, hide the property from the detail form. */
    isDetailHidden?: boolean;
    /** If true, hide the property from the list view. */
    isListHidden?: boolean;
    /** Ordinal position in the list table (ascending). */
    listSort?: number;
    /** Back-reference to the owning {@link Property}. Used by templates. */
    property: Property;
    /**
     * SPEC-14: per-property column span override on the form's 12-column grid.
     * Integer 1–12; out-of-range values are clamped at codegen time.
     * When undefined, `getDefaultSpan(property)` picks a default by type.
     */
    span?: number;
    /** SPEC-12: tab identifier — fields sharing a tab render together in a panel. */
    tab?: string;
    type: WidgetType;
}
/**
 * Definition of a single property inside an aggregate. Maps to a SQL column,
 * a DTO field, a GraphQL field, and optionally a form control.
 */
export interface Property {
    /** Owning aggregate name. Set by the loader; optional at author time. */
    aggregateName?: string;
    /** For `timestamp`: store with timezone when true. */
    applyTimezone?: boolean;
    /** Element descriptor for `array` types. */
    arrayOptions?: PropertyArrayOptions;
    /** SQL `AUTO_INCREMENT` for numeric primary keys. */
    autoIncrement?: boolean;
    /** Two-element tuple `[precision, scale]` for `decimal` types. */
    decimals?: number[];
    /** Literal default value emitted in the DTO / column definition. */
    defaultValue?: number | string;
    /** Values accepted by a scalar `enum` property. */
    enumOptions?: string[];
    /** Concrete example surfaced in Swagger / GraphQL docs. */
    example?: unknown;
    /**
     * Faker locale method name used by the mocker (e.g. `name.firstName`).
     * Overrides the default seed picked from {@link PropertyType}.
     */
    faker?: string;
    index?: PropertyIndex;
    /** Composite index columns when this property owns a multi-column index. */
    indexFields?: string[];
    indexName?: string;
    indexUsing?: PropertyIndexUsing;
    /** When true, the property participates in i18n table/relation generation. */
    isI18n?: boolean;
    length?: number;
    maxLength?: number;
    minLength?: number;
    /** Module path for relationship properties. Set by the loader. */
    modulePath?: string;
    /** Field name in camelCase (source of truth for every transformation). */
    name: string;
    nullable?: boolean;
    primaryKey?: boolean;
    readonly?: boolean;
    /** Relationship metadata when `type` is `relationship`. */
    relationship?: PropertyRelationship;
    type: PropertyType;
    /** Integer-only: unsigned column when true. */
    unsigned?: boolean;
    /** Frontend widget metadata, when the property is rendered in a form. */
    widget?: PropertyWidget;
}
/** Metadata for an ad-hoc endpoint emitted alongside CRUD defaults — GraphQL resolver or REST route. */
export interface AdditionalApi {
    httpMethod: HttpMethod;
    /** URL path of the endpoint (REST) or operation name (GraphQL). */
    path: string;
    resolverType: ResolverType;
}
/**
 * Pivot table definition used when a property declares a many-to-many
 * relationship with extra columns. The generator emits a first-class module
 * for the pivot itself using this metadata.
 */
export interface RelationshipPivot {
    additionalApis?: AdditionalApi[];
    aggregateName: string;
    /** Columns of the pivot table (usually the two foreign keys plus extras). */
    aggregateProperties: Property[];
    boundedContextName: string;
    /** Templates skipped when generating the pivot module. */
    excludedFiles?: string[];
    /** CRUD operations skipped when generating the pivot module. */
    excludedOperations?: string[];
    hasAuditing?: boolean;
    hasOAuth?: boolean;
    hasTenant?: boolean;
    moduleName: string;
    moduleNames: string;
}
/**
 * Full schema for a generated module. This is the in-memory representation
 * loaded from `cliter/<bc>/<module>.aurora.yaml`, after validation and
 * default-filling.
 */
export interface ModuleDefinitionSchema {
    additionalApis?: AdditionalApi[];
    aggregateName: string;
    aggregateProperties: Property[];
    boundedContextName: string;
    /** Templates skipped when generating this module. */
    excludedFiles?: string[];
    /** CRUD operations skipped when generating this module. */
    excludedOperations?: string[];
    /** Frontend-only presentation metadata (icon, grammatical gender, ...). */
    front?: {
        /**
         * How the detail surface is presented. See {@link DetailMode}.
         * Default `'view'` (routed page). `'dialog'` embeds the form inside the list.
         */
        detailMode?: DetailMode;
        /**
         * Human-readable display label for this aggregate. Accepts two shapes
         * detected automatically by the codegen:
         *   - **Identifier shape**: a bare JS identifier (matches
         *     `/^[a-zA-Z_$][a-zA-Z0-9_$]*$/`) naming a single property —
         *     e.g. `'email'`. Used directly as a property reference.
         *   - **Template shape**: an interpolation template containing one or
         *     more `{<identifier>}` placeholders — e.g. `'{code} - {name}'`.
         *     The codegen substitutes each placeholder with `<row>.<identifier>`
         *     at emit time. Anything that doesn't match the placeholder grammar
         *     (including `{}`, `{not.a.field}`, `{123invalid}`) is emitted
         *     verbatim.
         * Consumed by list-component delete-toast text, FK column auto-include
         * accessors, and FK column header rendering. Defaults to `'name'`
         * (identifier shape) when unset. See
         * `openspec/specs/frontend-module-generator/spec.md` →
         * "Schema — `front.displayField` attribute".
         */
        displayField?: string;
        /**
         * SPEC-15: when true, the module generates embed-mode artifacts
         * (`*-form-embed.component.ts`, `getXEmbedColumns` factory in
         * `*.columns.ts`, `mode` polymorphic input on the list-component).
         * Required when another module references this one via
         * `widget.type: grid-elements-manager`. Default `false`.
         */
        embedSupport?: boolean;
        /**
         * Grammatical gender of the module's singular noun. Used by the
         * generator to pick `F`/`M` variants from the global i18n JSON
         * (e.g. `New.F` → "Nueva", `New.M` → "Nuevo"). Ignored by languages
         * without grammatical gender.
         */
        gender?: Gender;
        outlineFontSetIcon?: string;
        outlineIcon?: string;
        solidFontSetIcon?: string;
        solidIcon?: string;
    };
    hasAuditing: boolean;
    hasOAuth: boolean;
    hasTenant: boolean;
    moduleName: string;
    moduleNames: string;
}
/**
 * Build a complete ModuleDefinitionSchema from a RelationshipPivot.
 * Every field is explicit — if ModuleDefinitionSchema gains a new required field,
 * TypeScript will force it to be added here.
 */
export declare function buildPivotSchema(pivot: RelationshipPivot): ModuleDefinitionSchema;
/**
 * Entry persisted in `cliter/<bc>/.locks/<scope>/<module>.lock.json`.
 *
 * Records the integrity hash of a generated file so subsequent regenerations
 * can tell whether the user edited it. The optional `regions` map enables
 * per-preservation-region hashing — see the `lock-file.ts` utilities.
 */
export interface LockFile {
    /** SHA-1 hash of the skeleton (body of preservation regions excluded), prefixed with `sha1:`. */
    integrity: string;
    /** Relative path of the file, using POSIX separators. */
    path: string;
    /**
     * Map of preservation region name → SHA-1 of the normalized body the
     * template produced on the previous generation. Absence means the entry
     * predates preservation-regions support; the merge falls back to preserving
     * all region bodies to stay safe.
     */
    regions?: Record<string, string>;
}
/**
 * Declaration of an import statement handled by `code-gen.importManager`.
 * Allows templates to declare imports at render time and let the helper
 * de-duplicate, group and sort them consistently.
 */
export interface ImportStatement {
    /** If true, emitted as a default import (`import X from '...'`). */
    defaultImport?: boolean;
    /** Named imports, or a single default/namespace identifier. */
    items: string | string[];
    /** If true, each named item goes on its own line. */
    oneRowByItem?: boolean;
    /** Module specifier (`@nestjs/common`, `./user.model`, ...). */
    path: string;
}
/**
 * Declaration of a constructor parameter marked for DI (`constructor(private readonly x: X)`).
 * Consumed by the `constructorInjection` helper in `code-gen`.
 */
export interface ConstructorInjectionStatement {
    /** Type name / class used as the parameter type. */
    className: string;
    readonly?: boolean;
    scope: 'private' | 'protected' | 'public';
    /** Identifier the parameter binds to. */
    variableName: string;
}
/** Declaration of a locally injected variable (used by `variableInjection` helper). */
export interface VariableInjectionStatement {
    className: string;
    variableName: string;
}
/**
 * Return-type descriptor used when generating methods that destructure a
 * named result. Kept minimal on purpose — see `code-gen` callers for usage.
 */
export interface ReturnTypeStatement {
    className: string;
    variableName: string;
}
/**
 * Aggregated context passed to top-level commands. Bundles the schema being generated,
 * its scope, the applicable lockfile slice, and CLI flags.
 */
export interface GenerationContext {
    /** Directory that anchors every relative path used during this run. */
    baseDir: string;
    flags: {
        /** Overwrite files whose integrity matches the lockfile. */
        force?: boolean;
        /** Skip emission of GraphQL type definitions. */
        noGraphQLTypes?: boolean;
        /** Force overwrite of interfaces even without `force`. */
        overwriteInterface?: boolean;
        /** Emit unit/integration tests along with production code. */
        tests?: boolean;
        /** Enable per-file / per-region log lines. */
        verbose?: boolean;
    };
    /** Lockfile entries applicable to the files about to be generated. */
    lockFiles: LockFile[];
    /** Paths of files whose skeleton was detected as user-modified this run. */
    overwrittenFiles: string[];
    schema: ModuleDefinitionSchema;
    scope: Scope;
}
