import { Attr } from 'ts-framework' import { availableTripStatuses, TripStage } from '../constants' import { TripAssistanceResponseDTO } from './trip-assistance' import { CreateTripLocationDTO, TripLocationResponseDTO } from './trip-location' import { CreateTripProductDTO } from './trip-product' import { CreateTripServiceDTO } from './trip-service' import { CreateTripRiderDTO, TripRiderResponseDTO } from './trip-rider' import { SimpleLocationDTO } from './location' export class TripImportDTO { @Attr({ type: String }) orgId: string @Attr({ type: String }) fileLocation: string @Attr({ type: String }) fileKey: string @Attr({ type: String }) s3Bucket: string } export class TripFiltersDTO { @Attr({ type: String, optional: true }) productIds?: string[] @Attr({ type: String, optional: true }) orgId?: string @Attr({ type: String, optional: true }) serviceId?: string @Attr({ type: String, optional: true }) operatorId?: string[] @Attr({ type: String, optional: true }) riderId?: string[] @Attr({ type: String, optional: true }) status?: string[] @Attr({ type: String, optional: true }) statusGroup?: string @Attr({ type: String, optional: true }) timeStart?: string @Attr({ type: String, optional: true }) timeEnd?: string @Attr({ type: String, optional: true }) timeField?: string @Attr({ type: String, optional: true }) sortBy?: string[] @Attr({ type: Number, optional: true }) skip?: number @Attr({ type: Number, optional: true }) take?: number } export class TripPoint { @Attr({ type: Number }) lat: number @Attr({ type: Number }) lng: number @Attr({ type: Number }) bearing: number } export class ZoneTripFiltersDTO { @Attr({ type: String }) orgId: string @Attr({ type: String }) zoneId: string } class OperatorResponseDTO { @Attr({ type: String }) id: string @Attr({ type: String }) firstName: string @Attr({ type: String }) lastName: string @Attr({ type: String }) operatorId: string } class ProviderProductResponseDTO { @Attr({ type: String }) id: string @Attr({ type: String }) pricingId: string @Attr({ type: String }) productId: string @Attr({ type: String }) name: string } class ServiceResponseDTO { @Attr({ type: String }) id: string @Attr({ type: String }) serviceId: string @Attr({ type: String }) name: string } class StatusDTO { @Attr({ type: String }) id: string @Attr({ type: String }) status: string @Attr({ type: Date }) createdAt: Date } class VehicleDTO { @Attr({ type: String }) id: string @Attr({ type: String }) licensePlate: string @Attr({ type: String }) make: string @Attr({ type: String }) model: string @Attr({ type: String }) vehicleId: string } class TripLocationDTO { @Attr({ type: String }) id: string @Attr({ type: String }) city: string @Attr({ type: String }) fullAddress: string @Attr({ type: Number }) latitude: number @Attr({ type: Number }) longitude: number @Attr({ type: String, optional: true }) zipCode?: string @Attr({ type: String, optional: true }) notes?: string } class TripRiderDTO { @Attr({ type: String }) id: string @Attr({ type: String }) firstName: string @Attr({ type: String }) lastName: string @Attr({ type: String }) riderId: string @Attr({ type: String, optional: true }) photo?: string } class RiderTripDTO { @Attr({ type: String }) id: string @Attr({ type: TripAssistanceResponseDTO }) assistance: TripAssistanceResponseDTO[] @Attr({ type: TripLocationDTO }) dropoffLocation: TripLocationDTO @Attr({ type: TripLocationDTO }) pickupLocation: TripLocationDTO @Attr({ type: TripRiderDTO }) rider: TripRiderDTO @Attr({ type: Number }) riderCost: number } export class ActiveTripsRequestDTO { @Attr({ type: Number }) numberOfRecords: number @Attr({ type: String }) organizationId: string @Attr({ type: String }) stage: string } // Used by goin-trip tripRepository for creating a single trip object export class CreateTripDTO { @Attr({ type: String }) organizationId: string @Attr({ type: CreateTripProductDTO }) product: CreateTripProductDTO @Attr({ type: CreateTripServiceDTO }) service: CreateTripServiceDTO @Attr({ type: CreateTripLocationDTO }) dropoffLocation: CreateTripLocationDTO @Attr({ type: CreateTripLocationDTO }) pickupLocation: CreateTripLocationDTO @Attr({ type: String, optional: true }) notes?: string @Attr({ type: Number, optional: true }) estimatedPickup?: number @Attr({ type: Number, optional: true }) estimatedPrice?: number @Attr({ type: Number, optional: true }) estimatedFare?: number @Attr({ type: String, optional: true }) scheduledPickupTime?: string @Attr({ type: String, optional: true }) scheduledDropoffTime?: string @Attr({ type: CreateTripRiderDTO }) rider: CreateTripRiderDTO } export class UpdateTripDTO { @Attr({ type: Number, optional: true }) duration?: number @Attr({ type: Number, optional: true }) distance?: number @Attr({ type: String, optional: true }) notes?: string @Attr({ type: Object, optional: true }) operatorLocation?: { type: string, coordinates: number[] } @Attr({ type: TripPoint, optional: true }) polyline?: TripPoint[] @Attr({ type: String, optional: true }) routePolyline?: string @Attr({ type: Object, optional: true }) bounds?: { south: number west: number north: number east: number } @Attr({ type: String, optional: true }) scheduledPickupTime?: string @Attr({ type: String, optional: true }) scheduledDropoffTime?: string @Attr({ type: String, optional: true }) externalEta?: string @Attr({ type: String, optional: true }) startMileage?: string @Attr({ type: String, optional: true }) endMileage?: string @Attr({ type: String, optional: true }) positiveFeedback?: string @Attr({ type: String, optional: true }) negativeFeedback?: string } export class AddTripRiderFeedbackDTO { @Attr({ type: String, optional: true }) riderPositiveFeedback?: string @Attr({ type: String, optional: true }) riderNegativeFeedback?: string @Attr({ type: Boolean }) isRiderPositiveFeedback?: boolean } export class AddTripDriverFeedbackDTO { @Attr({ type: String, optional: true }) driverPositiveFeedback?: string @Attr({ type: String, optional: true }) driverNegativeFeedback?: string @Attr({ type: Boolean }) isDriverPositiveFeedback?: boolean } export class TripEstimatesDTO { @Attr({ type: Number, optional: true }) eta?: number @Attr({ type: Number, optional: true }) price?: number @Attr({ type: Number, optional: true }) fare?: number @Attr({ type: Number, optional: true }) duration?: number @Attr({ type: Number, optional: true }) distance?: number } // This payload represents the data passed through the controllers/services when creating a trip export class CreateTripRequestDTO { @Attr({ type: String }) organizationId: string @Attr({ type: CreateTripLocationDTO }) dropoffLocation: CreateTripLocationDTO @Attr({ type: CreateTripLocationDTO }) pickupLocation: CreateTripLocationDTO @Attr({ type: CreateTripRiderDTO }) rider: CreateTripRiderDTO @Attr({ type: CreateTripProductDTO }) product: CreateTripProductDTO @Attr({ type: CreateTripServiceDTO }) service: CreateTripServiceDTO @Attr({ type: TripEstimatesDTO, optional: true }) estimates?: TripEstimatesDTO @Attr({ type: String, optional: true }) notes?: string @Attr({ type: String, optional: true }) routePolyline?: string @Attr({ type: Object, optional: true }) bounds?: { south: number west: number north: number east: number } @Attr({ type: String, optional: true }) tripType?: string @Attr({ type: Number, optional: true }) additionalRiders?: number } export class ScheduledTripRequestDTO { @Attr({ type: String }) organizationId: string @Attr({ type: CreateTripLocationDTO }) dropoffLocation: CreateTripLocationDTO @Attr({ type: CreateTripLocationDTO }) pickupLocation: CreateTripLocationDTO @Attr({ type: CreateTripRiderDTO }) rider: CreateTripRiderDTO @Attr({ type: CreateTripProductDTO }) product: CreateTripProductDTO @Attr({ type: CreateTripServiceDTO }) service: CreateTripServiceDTO @Attr({ type: String, optional: true }) scheduledPickupTime?: string @Attr({ type: String, optional: true }) scheduledDropoffTime?: string @Attr({ type: TripEstimatesDTO, optional: true }) estimates?: TripEstimatesDTO @Attr({ type: String, optional: true }) notes?: string @Attr({ type: String, optional: true }) vehicleId?: string @Attr({ type: String, optional: true }) operatorId?: string @Attr({ type: String, optional: true }) routePolyline?: string @Attr({ type: Object, optional: true }) bounds?: { south: number west: number north: number east: number } @Attr({ type: String, optional: true }) tripType?: string @Attr({ type: Number, optional: true }) additionalRiders?: number } export class TripProductResponseDTO { id: string name: string integrationId?: string shouldDispatch?: boolean } export class TripDomainResponseDTO { id: string createdAt: Date externalId?: string organizationId: string polyline?: TripPoint[] operator: OperatorResponseDTO | null operatorLocation: object | null product: TripProductResponseDTO | null pickupLocation: TripLocationResponseDTO dropoffLocation: TripLocationResponseDTO rider: TripRiderResponseDTO status: StatusDTO[] service: ServiceResponseDTO | null vehicle: VehicleDTO | null } export class RecentTripsResponseDTO { today: TripDomainResponseDTO[] recent: TripDomainResponseDTO[] } export class TripDTO { @Attr({ type: RiderTripDTO }) riders: RiderTripDTO[] @Attr({ type: CreateTripLocationDTO }) dropoffLocation: CreateTripLocationDTO @Attr({ type: CreateTripLocationDTO }) pickupLocation: CreateTripLocationDTO @Attr({ type: CreateTripProductDTO }) product: CreateTripProductDTO @Attr({ type: Number }) riderCount: number @Attr({ type: Number }) totalCost: number @Attr({ type: String }) type: string } class VehicleRelation { @Attr({ type: String }) id: string } class OperatorRelation { @Attr({ type: String }) id: string } export class SetOperatorVehicleDTO { @Attr({ type: String }) id: string @Attr({ type: VehicleRelation, optional: true }) vehicle?: VehicleRelation @Attr({ type: OperatorRelation, optional: true }) operator?: OperatorRelation } export interface ActiveTripsByStagesResponseDTO { stage: TripStage, items: TripDomainResponseDTO[] total: number } export class UpdateTripStatusRequestDTO { @Attr({ type: String }) tripId: string @Attr({ type: String, resolver: { type: 'enum', params: availableTripStatuses } }) status: string @Attr({ type: String, optional: true }) comment?: string @Attr({ type: Object, optional: true }) data?: object @Attr({ type: Date, optional: true }) createdAt?: Date } export class PersistPolylineDTO { @Attr({ type: String }) tripId: string @Attr({ type: TripPoint }) polyline: TripPoint[] } export interface TripChargeResponseDTO { riderFare: number cancellationPrice: number } export interface IntegrationTripInfoResponseDTO { status: string comment: string price: number operator: { id: string name: string firstName: string lastName: string phone: string }, vehicle: { make: string model: string licensePlate: string }, location: { lat: number lng: number } } export class CompactTripDTO { @Attr({ type: String }) id: string @Attr({ type: String, optional: true }) organizationId?: string @Attr({ type: String, optional: true }) serviceId?: string @Attr({ type: String, optional: true }) productId?: string @Attr({ type: SimpleLocationDTO }) destination: SimpleLocationDTO @Attr({ type: SimpleLocationDTO }) origin: SimpleLocationDTO @Attr({ type: String }) riderId: string @Attr({ type: String, optional: true }) operatorId?: string @Attr({ type: String, optional: true }) scheduledPickupTime?: string @Attr({ type: String, optional: true }) scheduledDropoffTime?: string @Attr({ type: String, optional: true }) status?: string @Attr({ type: String, optional: true }) notes?: string } export class GetRiderServiceTripCountDTO { @Attr({ type: String }) riderId: string @Attr({ type: String }) serviceId: string @Attr({ type: String }) duration: string }