import { ConfigService } from '@nestjs/config';
import { EventEmitter2 } from '@nestjs/event-emitter';
import { Model } from 'mongoose';
import { GpsPointDocument } from '../gps/schemas/gps-point.schema';
import { TripsService } from '../trips/trips.service';
import { GoogleDirectionsClient } from './google-directions.client';
import { GoogleRoadsClient } from './google-roads.client';
import { MatchJobDocument, MatchReason } from './schemas/match-job.schema';
import { RouteSegmentDocument, RouteSegmentKind } from './schemas/route-segment.schema';
export interface MatchedRouteResultDto {
    requestId: string;
    status: 'pending' | 'ready' | 'failed';
    engine?: string;
    matchedAt?: string;
    officialDistanceKm?: number;
    provisionalDistanceKm?: number;
    coveragePct?: number;
    matchedPct?: number;
    estimatedPct?: number;
    legs: Array<{
        legId: string;
        officialDistanceKm?: number;
        provisionalDistanceKm?: number;
        confidence?: number;
        estimatedPct?: number;
        matchedPolylineEncoded?: string;
        segments: Array<{
            segId: string;
            legId?: string;
            kind: RouteSegmentKind;
            confidence: number;
            lengthM: number;
            fromTimestamp?: string;
            toTimestamp?: string;
            polylineEncoded: string;
            matchMethod?: string;
        }>;
    }>;
    segments: Array<{
        segId: string;
        legId?: string;
        kind: RouteSegmentKind;
        confidence: number;
        lengthM: number;
        fromTimestamp?: string;
        toTimestamp?: string;
        polylineEncoded: string;
        matchMethod?: string;
    }>;
    error?: string;
}
export declare class MapMatchingService {
    private readonly gpsModel;
    private readonly segmentModel;
    private readonly jobModel;
    private readonly trips;
    private readonly roads;
    private readonly directions;
    private readonly config;
    private readonly events;
    private readonly catchUpTimers;
    private readonly running;
    constructor(gpsModel: Model<GpsPointDocument>, segmentModel: Model<RouteSegmentDocument>, jobModel: Model<MatchJobDocument>, trips: TripsService, roads: GoogleRoadsClient, directions: GoogleDirectionsClient, config: ConfigService, events: EventEmitter2);
    getMatchedRoute(requestId: string): Promise<MatchedRouteResultDto>;
    triggerMatch(requestId: string, reason?: MatchReason): Promise<MatchedRouteResultDto>;
    scheduleCatchUp(requestId: string): void;
    onGpsBatch(payload: {
        tripId?: string;
        count?: number;
    }): void;
    onPunch(payload: {
        tripId?: string;
        type?: string;
    }): void;
    private handleArrivalMatch;
    runMatch(requestId: string, reason: MatchReason): Promise<MatchedRouteResultDto>;
    private fillGpsGapsWithDirections;
    private shouldDirectionsFillGap;
    private pickSaneRoute;
    private maxGapSeconds;
    private finishJob;
    private applyToTrip;
    private buildResultFromPersisted;
}
