import type { EToolsKey } from "../enum";
import type { ShapeOptions } from "../tools";
import type { PencilOptions } from "../tools/pencil";
export type AutoShapePoint = [number, number];
export type AutoShapeKind = "straight" | "arrow" | "rectangle" | "ellipse" | "triangle" | "rhombus" | "star" | "none";
export interface AutoShapeBounds {
    minX: number;
    minY: number;
    maxX: number;
    maxY: number;
}
export interface AutoShapeMetrics {
    pathLength: number;
    chordLength: number;
    straightness: number;
    closureDistance: number;
    closureRatio: number;
    bboxWidth: number;
    bboxHeight: number;
    bboxDiagonal: number;
    aspectRatio: number;
    cornerCount: number;
    angleVariance: number;
    radialVariance: number;
    bboxCornerCloseness: number;
    diamondCloseness: number;
}
export interface AutoShapeContext {
    viewId: string;
    scenePath?: string;
    pencilOptions: PencilOptions;
    rawPoints: AutoShapePoint[];
    points: AutoShapePoint[];
    start: AutoShapePoint;
    end: AutoShapePoint;
    bbox: AutoShapeBounds;
    metrics: AutoShapeMetrics;
}
export interface AutoShapeTemplateDefinition {
    id: string;
    semanticKind: Exclude<AutoShapeKind, "none">;
    points: AutoShapePoint[];
    threshold?: number;
}
export interface AutoShapeCandidate {
    kind: Exclude<AutoShapeKind, "none">;
    templateId: string;
    score: number;
    threshold: number;
    distance: number;
}
export interface AutoShapeResult {
    kind: AutoShapeKind;
    score: number;
    threshold: number;
    recognized: boolean;
    bbox: AutoShapeBounds;
    start: AutoShapePoint;
    end: AutoShapePoint;
    points: AutoShapePoint[];
    templateId?: string;
    metrics: AutoShapeMetrics;
    candidates: AutoShapeCandidate[];
}
export interface AutoShapeMappedWork {
    toolsType: EToolsKey;
    opt: ShapeOptions;
    op: number[];
}
export type AutoShapePostProcessor = (candidate: AutoShapeCandidate, context: AutoShapeContext) => AutoShapeCandidate | null;
export type AutoShapeMapper = (result: AutoShapeResult, context: AutoShapeContext) => AutoShapeMappedWork | null;
export interface AutoShapeDefinition {
    kind: Exclude<AutoShapeKind, "none">;
    templates: AutoShapeTemplateDefinition[];
    postProcessor?: AutoShapePostProcessor;
    mapper: AutoShapeMapper;
    enabledInV1?: boolean;
}
