import { Attr } from 'ts-framework' import { SimpleLocationDTO } from './location' import { UserPhoneNumberDTO } from './user-phones' class AssistanceDTO { @Attr({ type: String }) assistanceNotes: string @Attr({ type: String }) mobilityNotes: string @Attr({ type: String }) mobilityName: string } class AssistanceResponseDTO { instruction: string name: string type: string } class CreateAssistanceDTO { @Attr({ type: String, optional: true }) assistanceNotes?: string @Attr({ type: String }) mobilityId: String @Attr({ type: String }) mobilityName: string @Attr({ type: String, optional: true }) mobilityNotes?: string } class DispatchLocationResponseDTO { address?: string | null lat: number lng: number notes?: string | null } class MobilityDTO { @Attr({ type: String }) name: string @Attr({ type: String }) instruction: string @Attr({ type: String }) type: string } class MobilityResponseDTO { name: string note: string type: string } class PhoneNumberResponseDTO { countryCode: string number: string type: string } class ProductDTO { @Attr({ type: String }) id: string @Attr({ type: String }) name: string @Attr({ type: String, optional: true }) integrationId?: string @Attr({ type: Boolean, optional: true }) shouldDispatch?: boolean } class ProviderDTO { @Attr({ type: String }) id: string @Attr({ type: String }) name: string @Attr({ type: String }) productId: string @Attr({ type: String }) productName: string } class RiderEmailDTO { @Attr({ type: String }) emailAddress: string } export class DispatchRiderDTO { @Attr({ type: String }) id: string @Attr({ type: String }) firstName: string @Attr({ type: String }) lastName: string @Attr({ type: UserPhoneNumberDTO }) phone: UserPhoneNumberDTO } class RiderResponseDTO { id: string email: RiderEmailDTO | null firstName: string lastName: string phoneNumber: PhoneNumberResponseDTO[] photo: string username: string } class RiderTripDTO { @Attr({ type: CreateAssistanceDTO }) assistance: CreateAssistanceDTO[] @Attr({ type: String, optional: true }) dropoffNotes?: string @Attr({ type: String, optional: true }) pickupNotes?: string @Attr({ type: DispatchRiderDTO }) rider: DispatchRiderDTO @Attr({ type: Number, optional: true }) riderCost?: number } class StatusDTO { @Attr({ type: String, optional: true }) comment?: string @Attr({ type: Date }) createdAt: Date @Attr({ type: String }) createdBy: string @Attr({ type: String }) status: string } class StatusResponseDTO { comment: string createdAt: Date createdBy: string status: string } class TelemetryDTO { @Attr({ type: Number }) bearing: number @Attr({ type: Number }) speed: number } class UserDTO { @Attr({ type: String }) id: string @Attr({ type: String }) firstName: string @Attr({ type: String }) lastName: string @Attr({ type: Boolean }) isOperator: boolean } export class CreateDispatchVehicleDTO { @Attr({ type: Number, optional: true }) vehicleId?: number @Attr({ type: String, optional: true }) make?: string @Attr({ type: String, optional: true }) model?: string @Attr({ type: String, optional: true }) licensePlate?: string } export class DispatchLocationDTO { @Attr({ type: String, optional: true }) address?: string @Attr({ type: Number }) lat: number @Attr({ type: Number }) lng: number @Attr({ type: String, optional: true }) notes?: string } export class DispatchAcceptedDTO { @Attr({ type: String }) operatorId: string @Attr({ type: String }) tripId: string } export class DispatchCancelledDTO { @Attr({ type: String, optional: true }) operatorId?: string @Attr({ type: String }) tripId: string } export class DispatchTripDTO { @Attr({ type: String }) id: string @Attr({ type: SimpleLocationDTO }) destination: SimpleLocationDTO @Attr({ type: SimpleLocationDTO }) origin: SimpleLocationDTO @Attr({ type: ProductDTO }) product: ProductDTO @Attr({ type: DispatchRiderDTO }) rider: DispatchRiderDTO @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 }) lastStatus?: string @Attr({ type: String, optional: true }) notes?: string } export class NotifyAboutTripChangesDTO { @Attr({ type: String }) trip: string } export class PingDTO { @Attr({ type: DispatchLocationDTO }) location: DispatchLocationDTO @Attr({ type: TelemetryDTO }) telemetry: TelemetryDTO @Attr({ type: Date }) updatedAt: Date @Attr({ type: String }) userId: string @Attr({ type: Number, optional: true }) wheelchairCapacity?: number @Attr({ type: Number, optional: true }) ambulatoryCapacity?: number @Attr({ type: Number, optional: true }) cotCapacity?: number @Attr({ type: String, optional: true }) productIds?: string[] @Attr({ type: String, optional: true }) organizationId?: string @Attr({ type: String, optional: true }) tripId?: string @Attr({ type: String, optional: true }) dispatchedTripId?: string } export class PingAvailableTripsRequestDTO { @Attr({ type: DispatchLocationDTO }) location: DispatchLocationDTO @Attr({ type: TelemetryDTO }) telemetry: TelemetryDTO @Attr({ type: Date }) updatedAt: Date @Attr({ type: String }) productIds: string[] } export class PingCurrentTripRequestDTO { @Attr({ type: DispatchLocationDTO }) location: DispatchLocationDTO @Attr({ type: TelemetryDTO }) telemetry: TelemetryDTO @Attr({ type: Date }) updatedAt: Date } export class DispatchFullTripResponseDTO { id: string rider: RiderResponseDTO pickUpLocation: DispatchLocationResponseDTO dropOffLocation: DispatchLocationResponseDTO pickUpTime: Date estimatedRoutePolyline: string estimatedTimeTravel: number statuses: StatusResponseDTO[] mobilities: MobilityResponseDTO[] assistances: AssistanceResponseDTO[] ridersNumber: number attendantsNumber: number routeToNextLocation: string timeToNextLocation: number } export class DispatchTripResponseDTO { operatorId: string status: string tripId: string } export class GetAvailableProductsDTO { @Attr({ type: Number }) lat: number @Attr({ type: Number }) lng: number @Attr({ type: String, optional: true }) productIds?: string[] } export class GetNearbyETAsByProductsIdsRequestDTO { @Attr({ type: String }) providerProductIds: string[] @Attr({ type: Number }) lat: number @Attr({ type: Number }) lng: number @Attr({ type: String, optional: true }) address?: string @Attr({ type: String, optional: true }) notes?: string } export interface ProviderProductWithETAResponseDTO { providerProductId: string, eta: number } interface AssignmentTimeRangeDTO { assignedDate: Date period: number } export interface AvailableTripsResponseDTO { trip: DispatchTripDTO assignmentTimeRange: AssignmentTimeRangeDTO } export interface CurrentTripResponseDTO { trip: DispatchTripDTO | null }