package net.explorviz.history.server.resources;

import java.io.FileNotFoundException;
import javax.annotation.security.RolesAllowed;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import net.explorviz.history.repository.persistence.LandscapeRepository;
import net.explorviz.history.repository.persistence.ReplayRepository;
import net.explorviz.shared.landscape.model.landscape.Landscape;


/**
 * Resource providing persisted {@link Landscape} data for the frontend.
 */
@Path("v1/landscapes")
@RolesAllowed({"admin"})
public class LandscapeResource {

  private static final String MEDIA_TYPE = "application/vnd.api+json";

  private final LandscapeRepository<Landscape> landscapeRepo;
  private final ReplayRepository<Landscape> replayRepo;


  @Inject
  public LandscapeResource(final LandscapeRepository<Landscape> landscapeRepo,
      final ReplayRepository<Landscape> replayRepo) {
    this.landscapeRepo = landscapeRepo;
    this.replayRepo = replayRepo;
  }

  @GET
  @Path("/by-timestamp")
  @Produces(MEDIA_TYPE)
  public Landscape getLandscapeByTimestamp(@QueryParam("timestamp") final long timestamp) {
    return this.landscapeRepo.getByTimestamp(timestamp);
  }

  @GET
  @Path("/by-uploaded-timestamp/{timestamp}")
  @Produces(MEDIA_TYPE)
  public Landscape getReplayLandscape(@PathParam("timestamp") final long timestamp)
      throws FileNotFoundException {
    return this.replayRepo.getByTimestamp(timestamp);
  }

}

@@ -795,33 +795,30 @@
 eRepository%3C
-Landscape
+String
 %3E landscapeR
@@ -852,33 +852,30 @@
 yRepository%3C
-Landscape
+String
 %3E replayRepo
@@ -945,25 +945,22 @@
 ository%3C
-Landscape
+String
 %3E landsc
@@ -998,25 +998,22 @@
 ository%3C
-Landscape
+String
 %3E replay
@@ -1168,33 +1168,30 @@
 )%0D%0A  public 
-Landscape
+String
  getLandscap
@@ -1407,25 +1407,22 @@
  public 
-Landscape
+String
  getRepl

use string based landscaperepositories for history-service