package com.google.tripmeout.frontend.servlet;

import com.google.tripmeout.frontend.storage.TripStorage;
import com.google.gson.Gson;
import java.io.IOException;
import java.util.Optional;
import java.util.UUID;
import javax.inject.Inject;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class TripParentServlet extends HttpServlet{

    private final Gson gson;
    
    @Inject
    public TripParentServlet(Gson gson){
        this.gson = gson;
    }

    @Override
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    
    response.setContentType("application/json") ; 
    response.getWriter().print(gson.toJson());
    }

    @Override
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {

        
    }

}
@@ -82,27 +82,17 @@
 end.
-storage.TripStorage
+TripModel
 ;%0Aim
@@ -410,16 +410,250 @@
 rvlet%7B%0A%0A
+    private static final String TRIP_PARENT_PARAM_KEY=%22tripName%22;%0A    private static final String LONG_PARAM_KEY=%22long%22;%0A    private static final String LAT_PARAM_KEY=%22lat%22;%0A    private static final String USER_ID_PARAM_KEY=%22userId%22;%0A
     priv
@@ -883,24 +883,26 @@
 n %7B%0A    %0A   
+//
  response.se
@@ -941,16 +941,18 @@
  ; %0A    
+//
 response
@@ -1112,18 +1112,614 @@
 on %7B
-%0A%0A        
+  %0A        String tripName = request.getParameter(TRIP_PARENT_PARAM_KEY);%0A        String longitude = request.getParameter(LONG_PARAM_KEY);%0A        String latitude = request.getParameter(LAT_PARAM_KEY);%0A        String userID = request.getParameter(USER_ID_PARAM_KEY);%0A       %0A        TripModel trip = TripModel.builder()%0A        .setId(UUID.randomUUID().toString())%0A        .setName(tripName)%0A        .setUserId(userID)%0A        .setLocationLat(Double.parseDouble(latitude))%0A        .setLocationLong(Double.parseDouble(longitude))%0A        .build();%0A%0A        response.getWriter().print(gson.toJson(trip));%0A%0A%0A%0A
 %0A   

create trip object in doPost