import { AggregationPipeline } from '../../common/aggregation-pipeline.js';
import { DelayStatus, OneOrTheOther, OperationalDate, OperationalStatus, Ride, RideAcceptanceStatus, RideAnalysisGradeWithNone, SeenStatus, TicketingStatus, UnixTimestamp } from '@tmlmobilidade/types';
/**
 * Creates MongoDB aggregation pipeline stages to calculate and categorize delay statuses.
 *
 * This function generates three aggregation stages:
 * 1. Calculates delay differences (in milliseconds) between scheduled and observed times
 * 2. Categorizes delays into statuses: 'delayed', 'early', 'ontime', or 'none'
 * 3. Removes intermediate calculation fields
 *
 * Delay thresholds:
 * - Delayed: > 5 minutes (300000 ms)
 * - Early: < -1 minute (-60000 ms)
 * - On-time: between -1 minute and 5 minutes
 * - None: missing scheduled or observed time data
 *
 * @returns {Array} Array of MongoDB aggregation pipeline stages
 */
export declare function ridesPipelineDelayStatus({ filter }?: {
    filter?: {
        end_delay_status?: DelayStatus[];
        start_delay_status?: DelayStatus[];
    };
}): AggregationPipeline<Ride>;
/**
 * Creates MongoDB aggregation pipeline stages to calculate and categorize operational statuses.
 *
 * This function generates four aggregation stages:
 * 1. Adds the current timestamp (now) to each document
 * 2. Calculates time differences from last seen and from start time
 * 3. Categorizes operational status: 'scheduled', 'missed', 'running', or 'ended'
 * 4. Removes intermediate calculation fields
 *
 * Operational status logic:
 * - Scheduled: within 10 minutes of start time and never seen
 * - Missed: more than 10 minutes after start time and never seen
 * - Running: last seen within 10 minutes
 * - Ended: default fallback (last seen more than 10 minutes ago)
 *
 * Time thresholds:
 * - Operational window: 10 minutes (600000 ms)
 *
 * @param {number} now - Current timestamp in milliseconds
 * @returns {Array} Array of MongoDB aggregation pipeline stages
 */
export declare function ridesPipelineOperationalStatus({ filter }?: {
    filter?: {
        operational_status?: OperationalStatus[];
    };
}): AggregationPipeline<Ride>;
/**
 * Creates MongoDB aggregation pipeline stages to calculate and categorize seen statuses.
 *
 * This function generates three aggregation stages:
 * 1. Adds the current timestamp (now) to each document
 * 2. Calculates time difference from last seen to now
 * 3. Categorizes seen status: 'gone', 'seen', or 'unseen'
 * 4. Removes intermediate calculation fields
 *
 * Seen status logic:
 * - Gone: last seen more than 30 seconds ago
 * - Seen: last seen within 30 seconds
 * - Unseen: no last seen time
 *
 * Time thresholds:
 * - Seen window: 30 seconds (30000 ms)
 *
 * @param {number} now - Current timestamp in milliseconds
 * @returns {Array} Array of MongoDB aggregation pipeline stages
 */
export declare function ridesPipelineSeenStatus({ filter }?: {
    filter?: {
        seen_status?: SeenStatus[];
    };
}): AggregationPipeline<Ride>;
export declare function ridesPipelineTicketingStatus({ filter }?: {
    filter?: {
        ticketing_status?: TicketingStatus[];
    };
}): AggregationPipeline<Ride>;
interface DatesRange {
    date_end: UnixTimestamp;
    date_start: UnixTimestamp;
}
interface OperationalDateRange {
    operational_date_end: OperationalDate;
    operational_date_start: OperationalDate;
}
type RidesPipelineFilter = OneOrTheOther<DatesRange, OperationalDateRange> & {
    acceptance_status?: ('none' | RideAcceptanceStatus)[];
    agency_ids?: string[];
    analysis_ended_at_last_stop_grade?: RideAnalysisGradeWithNone[];
    analysis_expected_apex_validation_interval?: RideAnalysisGradeWithNone[];
    analysis_simple_three_vehicle_events_grade?: RideAnalysisGradeWithNone[];
    analysis_transaction_sequentiality?: RideAnalysisGradeWithNone[];
    delay_statuses?: DelayStatus[];
    line_ids?: string[];
    operational_statuses?: OperationalStatus[];
    pattern_ids?: string[];
    search?: string;
    seen_statuses?: SeenStatus[];
    stop_ids?: string[];
    ticketing_status?: TicketingStatus[];
    vehicle_ids?: number[];
};
/**
 * Creates MongoDB aggregation pipeline stages to filter and process ride data.
 *
 * This function generates an aggregation pipeline with the following stages:
 * 1. Filters rides by scheduled time range (date_start to date_end)
 * 2. Optionally filters by line IDs
 * 3. Optionally filters by agency IDs
 * 4. Optionally searches rides by ride ID using regex pattern matching and, if present, by vehicle IDs in the search string (with support for "v:1117,1118" etc.)
 * 5. Adds acceptance status by joining from the ride_acceptances collection
 * 6. Filters by analysis grades (ended_at_last_stop, expected_apex_validation_interval, simple_three_vehicle_events)
 * 7. Filters by acceptance status (excluding 'none' if present)
 * 8. Applies delay, operational, and seen status filters using dedicated pipeline functions
 *
 * @param {Object} params - Parameters object
 * @param {RidesPipelineFilter} params.filter - Filter criteria for rides
 * @returns {AggregationPipeline<Ride>} Array of MongoDB aggregation pipeline stages
 */
export declare function ridesBatchAggregationPipeline({ ...filter }: RidesPipelineFilter): AggregationPipeline<Ride>;
export {};
