import { type SchematicBounds, type SchematicSheetGeometry } from '../schematic-engine/geometry.js'; import type { PrimitiveRotation } from '../schematic-model/primitive-bounds.js'; import { type PlacementCandidate, type PlacementConstraintRegion } from './placement.js'; export type FunctionalComponentRole = 'main' | 'decoupling-capacitor' | 'bulk-capacitor' | 'feedback-network' | 'pull-up' | 'pull-down' | 'boot-strap' | 'connector-protection' | 'connector-filter' | 'regulator-inductor' | 'regulator-compensation' | 'led-current-limit' | 'transistor-gate-resistor' | 'transistor-base-resistor' | 'test-point' | 'support'; export interface FunctionalLayoutComponent { id: string; blockId: string; role: FunctionalComponentRole; parentId?: string; renderedSize: { width: number; height: number; }; preferredRotation?: PrimitiveRotation; allowedRotations?: readonly PrimitiveRotation[]; minimumProximity?: number; } export interface FunctionalLayoutConstraints { minimumClearance: number; blockPadding: number; componentSpacing: number; preferredFlow: 'left-to-right' | 'top-to-bottom'; maximumSupportDistance: number; maximumSupportDistanceByRole?: Partial>; minimumReadableUtilization: number; maximumReadableUtilization: number; } export interface FunctionalLayoutPlanInput { sheet: SchematicSheetGeometry; a3FallbackSheet?: SchematicSheetGeometry; allowA3Fallback?: boolean; components: readonly FunctionalLayoutComponent[]; hardKeepouts?: readonly PlacementConstraintRegion[]; callerReservedRegions?: readonly PlacementConstraintRegion[]; existingOccupiedRegions?: readonly PlacementConstraintRegion[]; constraints?: Partial; } export interface FunctionalBlockReservation { blockId: string; bounds: SchematicBounds; componentIds: string[]; supportComponentIds: string[]; } export interface SupportComponentReservation { id: string; blockId: string; parentId?: string; role: FunctionalComponentRole; componentIds: string[]; bounds: SchematicBounds; } export interface FunctionalComponentPlacement extends PlacementCandidate { componentId: string; blockId: string; role: FunctionalComponentRole; parentId?: string; placementOrder: number; } export interface LayoutPlannerConflict { blockId?: string; componentId?: string; code: string; message: string; constraintIds: string[]; } export interface PageSuitabilityAttempt { pageSize: SchematicSheetGeometry['pageSize']; feasible: boolean; utilization: number; unsatisfiedConstraints: string[]; searchedBlockIds: string[]; } export interface FunctionalLayoutScore { overall: number; utilization: number; proximity: number; clearance: number; rationale: string[]; } export interface FunctionalLayoutPlan { feasible: boolean; deterministic: true; layoutHash: string; selectedSheet: SchematicSheetGeometry; blockReservations: FunctionalBlockReservation[]; supportReservations: SupportComponentReservation[]; placements: FunctionalComponentPlacement[]; placementOrder: string[]; occupancyMap: PlacementConstraintRegion[]; conflicts: LayoutPlannerConflict[]; pageSuitability: { attempts: PageSuitabilityAttempt[]; selectedPageSize?: SchematicSheetGeometry['pageSize']; a3FallbackRationale?: string; }; score: FunctionalLayoutScore; } export declare function planFunctionalLayout(input: FunctionalLayoutPlanInput): FunctionalLayoutPlan;