/** A point in projected SVG coordinates */
export interface Point2D {
	x: number;
	y: number;
}

/** A geographic coordinate from OSRM */
export interface GeoPoint {
	lng: number;
	lat: number;
}

/** General conic coefficients: Ax² + Bxy + Cy² + Dx + Ey + F = 0 */
export interface ConicCoeffs {
	A: number;
	B: number;
	C: number;
	D: number;
	E: number;
	F: number;
}

/** Classified conic type derived from the discriminant B²-4AC */
export type ConicType = "ellipse" | "parabola" | "hyperbola" | "circle" | "degenerate";

/** Rational quadratic Bézier: exact conic arc from p0 to p2 via control p1, weight w */
export interface RationalQuadBezier {
	p0: Point2D;
	p1: Point2D;
	p2: Point2D;
	w: number;
}

/** A fitted conic arc segment */
export interface ConicArc {
	coeffs: ConicCoeffs;
	type: ConicType;
	eccentricity: number;
	points: Point2D[];
	beziers: RationalQuadBezier[];
}

/** An intersection point between two conic arcs */
export interface IntersectionPoint {
	point: Point2D;
	arcIndexA: number;
	arcIndexB: number;
}

/** A fully processed route: OSRM geometry → projected → conic-fitted */
export interface FittedRoute {
	rawCoords: GeoPoint[];
	projectedPoints: Point2D[];
	arcs: ConicArc[];
	distance: number;
	duration: number;
}

/** Input for a single route query */
export interface RouteInput {
	start: GeoPoint;
	end: GeoPoint;
	label: string;
}
