// Path: common_client/src/main/java/nl/crowndov/displaydirect/commonclient/store/DataStore.java
// public class DataStore {
// 
//     private static Map<Integer, PassTime> departures = new HashMap<>();
// 
//     public static void apply(PassTime p) {
//         if (p.getStatus() == DisplayDirectMessage.PassingTimes.TripStopStatus.DELETED) {
//             departures.remove(p.getPassTimeHash());
//         } else {
//             departures.put(p.getPassTimeHash(), p);
//         }
//     }
// 
//     public static void apply(List<PassTime> p) {
//         p.forEach(DataStore::apply);
//     }
// 
//     public static List<PassTime> getDepartures() {
//         return departures.values().stream()
//                 .filter(PassTime::isCurrent)
//                 .sorted(Comparator.comparingInt(PassTime::getExpectedDepartureTime))
//                 .limit(11)
//                 .collect(Collectors.toList());
//     }
// 
// 
//     public static Collection<PassTime> getAll() {
//         return departures.values();
//     }
// }


import nl.crowndov.displaydirect.commonclient.store.DataStore;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
package nl.crowndov.displaydirect.virtual_screen.resources;



/**
 * Copyright 2017 CROW-NDOV
 *
 * This file is subject to the terms and conditions defined in file 'LICENSE.txt', which is part of this source code package.
 */
@Path("/v1/departures")
@Produces(MediaType.APPLICATION_JSON)
public class DepartureResource {

    @GET
    public Response getDepartures() {
// Path: common_client/src/main/java/nl/crowndov/displaydirect/commonclient/store/DataStore.java
// public class DataStore {
// 
//     private static Map<Integer, PassTime> departures = new HashMap<>();
// 
//     public static void apply(PassTime p) {
//         if (p.getStatus() == DisplayDirectMessage.PassingTimes.TripStopStatus.DELETED) {
//             departures.remove(p.getPassTimeHash());
//         } else {
//             departures.put(p.getPassTimeHash(), p);
//         }
//     }
// 
//     public static void apply(List<PassTime> p) {
//         p.forEach(DataStore::apply);
//     }
// 
//     public static List<PassTime> getDepartures() {
//         return departures.values().stream()
//                 .filter(PassTime::isCurrent)
//                 .sorted(Comparator.comparingInt(PassTime::getExpectedDepartureTime))
//                 .limit(11)
//                 .collect(Collectors.toList());
//     }
// 
// 
//     public static Collection<PassTime> getAll() {
//         return departures.values();
//     }
// }


// Path: virtual_screen/src/main/java/nl/crowndov/displaydirect/virtual_screen/resources/DepartureResource.java
import nl.crowndov.displaydirect.commonclient.store.DataStore;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

package nl.crowndov.displaydirect.virtual_screen.resources;



/**
 * Copyright 2017 CROW-NDOV
 *
 * This file is subject to the terms and conditions defined in file 'LICENSE.txt', which is part of this source code package.
 */
@Path("/v1/departures")
@Produces(MediaType.APPLICATION_JSON)
public class DepartureResource {

    @GET
    public Response getDepartures() {
        return Response.ok(DataStore.getDepartures()).build();