package com.google.sps.servlets;

import com.google.appengine.api.users.UserServiceFactory;
import com.google.sps.utilities.CommonUtils;
import java.io.IOException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/** Servlet that returns whether user is logged in and email of the user. */
@WebServlet("/login-status")
public class LoginStatusServlet extends HttpServlet {
  /**
   * Writes whether user is logged in and email of user if the user is logged in and empty string as
   * email of user otherwise to the response.
   *
   * @param request servlet request
   * @param response servlet response
   * @throws IOException if Input/Output error occurs
   */
  @Override
  public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
    response.setContentType("application/json;");

    LoginStatus status;
    if (UserServiceFactory.getUserService().isUserLoggedIn()) {
      status =
          new LoginStatus(true, UserServiceFactory.getUserService().getCurrentUser().getEmail());
    } else {
      status = new LoginStatus(false, "");
    }

    response.getWriter().println(CommonUtils.convertToJson(status));
  }

  private class LoginStatus {
    private boolean isLoggedIn;
    private String userEmail;

    public LoginStatus(boolean isLoggedIn, String userEmail) {
      this.isLoggedIn = isLoggedIn;
      this.userEmail = userEmail;
    }
  }
}

@@ -586,63 +586,10 @@
  in 
-and empty string as%0A   * email of user otherwise to the
+to
  res

Update comment.