/** * Port of RelationBuilder.php — generates Eloquent relation methods. */ import type { SchemaReader } from './schema-reader.js'; interface RelationResult { method: string; imports: string[]; } interface RelationContext { sourceTableName: string; targetTableName: string; /** Owning schema name (PascalCase) for OneToMany FK resolution. Issue #237. */ sourceSchemaName?: string; reader?: SchemaReader; /** Non-conventional physical table resolved from an explicit pivot schema. * Omitted when Laravel can infer the joining table from model basenames. */ pivotTableName?: string; /** Property names declared on the explicit `kind: pivot` schema for * this M2M (e.g. `["position", "notes"]`). Surfaced in the generated * `belongsToMany()` chain via `->withPivot(...)` so consumers can * read those columns through the relation. Empty / undefined when * the user has not added custom columns to the pivot schema. */ pivotProperties?: string[]; } /** Build Eloquent relation method PHP code. */ export declare function buildRelation(propName: string, property: Record, modelNamespace: string, context?: RelationContext): RelationResult | null; /** Generate the table name Laravel's joiningTable() infers from model basenames. */ export declare function generatePivotTableName(sourceModel: string, targetModel: string): string; /** Get the return type hint for a relation. */ export declare function getReturnType(relation: string): string; /** * Resolve the child-table FK column for a OneToMany when `mappedBy` / `inversedBy` * is absent. Prefer the single inverse ManyToOne on the target (omnify-go#166 * `column:` override included); if zero matches, fall back to the owning schema * name (external targets). If two or more matches, throw — omnify-go#242. * Issue #237. */ export declare function resolveHasManyForeignKey(propName: string, target: string, context?: RelationContext): string; /** * Build a chained `->orderBy('col', 'dir')` PHP fragment from an OrderByList. * Returns an empty string if no ordering is configured. Issue #40. */ export declare function formatOrderByChain(orderBy: unknown): string; export {};