import { type SchematicBounds, type SchematicPoint, type SchematicSheetGeometry } from '../schematic-engine/geometry.js'; import type { PrimitiveRotation } from '../schematic-model/primitive-bounds.js'; export type PlacementRegionKind = 'title-block' | 'page-border' | 'caller-reserved' | 'support-reservation' | 'existing-object'; export interface PlacementConstraintRegion { id: string; kind: PlacementRegionKind; bounds: SchematicBounds; primitiveId?: string; ownerId?: string; } export interface PlacementCandidate { origin: SchematicPoint; rotation: PrimitiveRotation; combinedBounds: SchematicBounds; } export type PlacementConflictCode = 'PAGE_BORDER_KEEP_OUT' | 'TITLE_BLOCK_KEEP_OUT' | 'CALLER_RESERVED_REGION' | 'SUPPORT_RESERVATION' | 'EXISTING_OBJECT_OCCUPIED' | 'MINIMUM_CLEARANCE'; export interface PlacementConflict { code: PlacementConflictCode; regionId: string; regionKind: PlacementRegionKind; candidateBounds: SchematicBounds; conflictingBounds: SchematicBounds; clearance: number; requiredClearance: number; message: string; } export interface PlacementAlternative extends PlacementCandidate { reason: string; } export interface PlacementCheckInput { sheet: SchematicSheetGeometry; candidate: PlacementCandidate; hardKeepouts?: readonly PlacementConstraintRegion[]; reservedRegions?: readonly PlacementConstraintRegion[]; occupiedRegions?: readonly PlacementConstraintRegion[]; minimumClearance?: number; maxAlternatives?: number; searchPreference?: SafeRegionPreference; } export interface PlacementCheckResult { accepted: boolean; proposed: PlacementCandidate; combinedBounds: SchematicBounds; clearances: Array<{ regionId: string; regionKind: PlacementRegionKind; clearance: number; }>; conflicts: PlacementConflict[]; suggestedAlternatives: PlacementAlternative[]; failure?: { code: 'NO_FEASIBLE_POSITION'; unsatisfiedConstraints: PlacementConflictCode[]; searchedCandidates: number; }; } export type SafeRegionPreference = 'upper-left' | 'upper-center' | 'upper-right' | 'center-left' | 'center' | 'center-right' | 'lower-left' | 'lower-center' | 'lower-right'; export interface SafeRegionInput { sheet: SchematicSheetGeometry; size: { width: number; height: number; }; preference?: SafeRegionPreference; hardKeepouts?: readonly PlacementConstraintRegion[]; reservedRegions?: readonly PlacementConstraintRegion[]; occupiedRegions?: readonly PlacementConstraintRegion[]; minimumClearance?: number; rotation?: PrimitiveRotation; } export interface SafeRegionResult { feasible: boolean; preference: SafeRegionPreference; candidate?: PlacementCandidate; check: PlacementCheckResult; rationale: string[]; } export declare function checkPlacement(input: PlacementCheckInput): PlacementCheckResult; export declare function selectSafeRegion(input: SafeRegionInput): SafeRegionResult;