package com.mzh.library.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class RoleAreaServlet extends HttpServlet {
    private static final String ROLE_HOME_JSP = "/WEB-INF/jsp/role-home.jsp";

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String servletPath = request.getServletPath();
        if (servletPath.startsWith("/admin")) {
            request.setAttribute("areaName", "系统管理");
            request.setAttribute("areaSummary", "账户、角色、权限和系统维护入口。");
        } else if (servletPath.startsWith("/librarian")) {
            request.setAttribute("areaName", "馆员工作台");
            request.setAttribute("areaSummary", "图书、读者、借阅、归还、续借和逾期处理入口。");
        } else {
            request.setAttribute("areaName", "读者中心");
            request.setAttribute("areaSummary", "馆藏检索和读者自助服务入口。");
        }

        request.getRequestDispatcher(ROLE_HOME_JSP).forward(request, response);
    }
}
