import BaseEntityService from '../../common/services/BaseEntityService/BaseEntityService'; import JourneyClientInterface from '../clients/JourneyClientInterface'; import JourneyServiceInterface from './JourneyServiceInterface'; import Journey from '../entity/Journey'; import JourneyVehicle from '../../JourneyVehicle/entity/JourneyVehicle'; import JourneyAdapterInterface from '../adapter/JourneyAdapterInterface'; import HTTPRequest from '../../Request/entity/HTTPRequest'; import RequestPromise from '../../common/DTO/RequestPromise'; import JourneyMessagingSelectableUsers from '../enums/JourneyMessagingSelectableUsers'; import JourneyMessagingSelectableMessageType from '../enums/JourneyMessagingSelectableMessageType'; export default class JourneyService extends BaseEntityService implements JourneyServiceInterface { protected client: JourneyClientInterface; protected transformer: JourneyAdapterInterface; reset(id: string): RequestPromise { const httpRequest = new HTTPRequest(); httpRequest.data = { id, }; return this.client.reset(httpRequest); } sendNotification(journey: string, target: JourneyMessagingSelectableUsers, message_type: JourneyMessagingSelectableMessageType, vehicles: Array, stops: Array, message: string, subject: string): RequestPromise { const httpRequest = new HTTPRequest(); httpRequest.data = this.transformer.prepareSendNotificationPayload(journey, target, message_type, vehicles, stops, message, subject); return this.client.sendNotification(httpRequest); } updateVehicles(id: string, vehicles: Array): RequestPromise { const httpRequest = new HTTPRequest(); httpRequest.data = this.transformer.prepareUpdateVehicles(id, vehicles); return this.client.updateVehicles(httpRequest); } }