import { IVPTripsPositionAttributes } from "../../../../../schema-definitions/vehicle-positions/models/interfaces/IVPTripsPositionAttributes";
import { IVPTripsLastPositionContext } from "../../../../../schema-definitions/vehicle-positions/models/interfaces/VPTripsLastPositionInterfaces";
import { IScheduleDto } from "../../../../../schema-definitions/vehicle-positions/redis/interfaces/IGtfsRunTripCacheDto";
import { Feature, Point } from "@turf/turf";
import { StatePositionEnum } from "../../../../../const";
import { GTFSRouteTypeEnum } from "../../../../../helpers/RouteTypeEnums";
import { IComputationTrip, ICurrentPositionProperties, IPositionToUpdate, IProcessedPositions, IShapeAnchorPoint, ITripPositionsWithGTFS, IUpdatePositionsIteratorOptions } from "../interfaces/VPInterfaces";
import { PositionHandlerEnum } from "./PositionHandlerEnum";
import { ValidToCalculator } from "./ValidToCalculator";
import { IStopTime } from "../../../../ropid-gtfs/interfaces/TripModelInterfaces";
export declare abstract class BasePositionsManager {
    protected readonly useEndTimestamp: boolean;
    protected readonly allowCancelState: boolean;
    protected static sortByOriginTimestamp: (a: IVPTripsPositionAttributes, b: IVPTripsPositionAttributes) => 1 | 0 | -1;
    protected abstract validToCalculator: ValidToCalculator;
    constructor({ useEndTimestamp, allowCancelState }: {
        useEndTimestamp?: boolean | undefined;
        allowCancelState?: boolean | undefined;
    });
    abstract updatePositions(options: IUpdatePositionsIteratorOptions, schedule: IScheduleDto[] | undefined): IProcessedPositions;
    protected abstract getClosestPoint(currentPosition: Feature<Point, ICurrentPositionProperties>, context: IVPTripsLastPositionContext | null, startDayTimestamp: number, thisClosestPoint: IShapeAnchorPoint, tripGtfsData: IComputationTrip, gtfsRouteType?: GTFSRouteTypeEnum): IPositionToUpdate;
    private getCurrentContext;
    /**
     * Compute positions and return computed positions
     *
     * @param {ITripPositionsWithGTFS} tripPositions - Trip positions with shape anchors data
     * @returns {IProcessedPositions} - Returns computed/updated positions
     */
    computePositions: (tripPositions: ITripPositionsWithGTFS, schedule?: IScheduleDto[] | undefined) => IProcessedPositions;
    /**
     * Decide how to process input position data
     *
     * @param {IVPTripsPositionAttributes} position - Input vehiclepositions_positions row data
     * @returns {PositionHandlerEnum} - Returns action handler enum
     */
    protected setPositionUpdateHandler: (position: IVPTripsPositionAttributes) => PositionHandlerEnum;
    /**
     * Returns estimate of point on shape, where the trip should be with appropriate delay
     *
     * @param {IShapeAnchorPoint[]} tripShapePoints - Precalculated trip shape equidistant points with scheduled times
     * @param {Feature<Point, ICurrentPositionProperties>} currentPosition - Current position of trip
     * @param {IVPTripsLastPositionContext | null} context - Context state, holds information about previous positions
     * @param {number} startDayTimestamp - Unix timestamp of midnight before trip starts
     * @returns {IPositionToUpdate} - Position object to update
     */
    protected getEstimatedPoint: (tripGtfsData: IComputationTrip, currentPosition: Feature<Point, ICurrentPositionProperties>, context: IVPTripsLastPositionContext | null, startDayTimestamp: number, gtfsRouteType?: GTFSRouteTypeEnum) => IPositionToUpdate;
    /**
     * Corrects time delay at stop with dwelling time
     *
     * @param {number} timeDelay - Initial computed delay in seconds, can be negative for trip ahead
     * @param {IVPTripsLastPositionContext | null} context - Context state, holds information about previous positions
     * @param {Feature<Point, ICurrentPositionProperties>} currentPosition - Feature Point of current position
     * @param {IShapeAnchorPoint} thisClosestPoint - Closest point of shape anchors
     * @param { departureTime: number; arrivalTime: number } stopTimes - departure and arrival stop times in seconds
     * @returns {number} - Result delay in seconds, can be negative for trip ahead
     */
    protected getCorrectedTimeDelay: (timeDelay: number, context: IVPTripsLastPositionContext | null, currentPosition: Feature<Point, ICurrentPositionProperties>, thisStopSequence: number, stopTimes: {
        departureTime: number;
        arrivalTime: number;
    }) => number;
    /**
     * Compute UTC timestamp of start of day when trip starts
     *
     * @param {number} startTimestamp - Unix timestamp of start of the trip
     * @param {number} firstStopTimeScheduledSeconds - Number of seconds from midnight of first stop departure
     * @returns {number} - Returns unix timestamp in milliseconds.
     */
    protected getStartDayTimestamp: (startTimestamp: number, firstStopTimeScheduledSeconds: number) => number;
    protected disruptAtStopStreak(position: IVPTripsPositionAttributes, positionToUpdate?: IPositionToUpdate | null): boolean;
    protected setFirstUniqueStopSequence(positionToUpdate: IPositionToUpdate | null, context: IVPTripsLastPositionContext, position: IVPTripsPositionAttributes): void;
    protected defaultNonTrackingPositionToUpdate(position: IVPTripsPositionAttributes, firstStopTime: IStopTime, startDayTimestamp: number, setAsInvisible: boolean, lastPositionDelayed: 0 | {
        delay: number | null;
        origin_timestamp: Date;
    } | null): IPositionToUpdate;
    /**
     * Get delay in seconds for positions before track to ensure correct delay propagation
     *
     * @param lastPositionDelay The last position delay in seconds
     * @param firstStopDepartureTime The first stop departure time in seconds. The time is measured from "noon minus 12h" of the
     * service day (effectively midnight except for days on which daylight savings time changes occur). For times occurring after
     * midnight on the service day, enter the time as a value greater than 24:00:00 in seconds. See also
     * <https://gtfs.org/schedule/reference/#:~:text=A%20phone%20number.-,Time,-%2D%20Time%20in%20the>.
     * @param positionOriginUnixTimestamp The Unix Epoch timestamp of the current position, in milliseconds
     * @param startDayUnixTimestamp The Unix Epoch timestamp of the start of the service day, in milliseconds
     */
    private getDelayBeforeTrack;
    protected isFreshNewVehicleInSystem(context: IVPTripsLastPositionContext, position: IVPTripsPositionAttributes, endTimestamp: Date | null): boolean;
    protected setLastPositionTracking(position: IVPTripsPositionAttributes, context: IVPTripsLastPositionContext, positionToUpdate: IPositionToUpdate | null): void;
    protected detectDuplicatePosition(position: IVPTripsPositionAttributes, lastPositionOriginTimestamp: number | null, positionsSource: IVPTripsPositionAttributes[]): StatePositionEnum.AFTER_TRACK | StatePositionEnum.DUPLICATE;
}
