package incheon.com.cmm;

import org.egovframe.rte.ptl.mvc.tags.ui.pagination.AbstractPaginationRenderer;

import javax.servlet.ServletContext;
import org.springframework.web.context.ServletContextAware;

/**
 * AdminPaginationRenderer.java 클래스
 * 
 * 관리자 페이지 전용 페이징 렌더러
 * 관리자 인터페이스에 최적화된 모던하고 일관된 스타일
 * 
 * @author 개발팀
 * @since 2024.12.19
 * @version 1.0
 */
public class AdminPaginationRenderer extends AbstractPaginationRenderer implements ServletContextAware {

    private ServletContext servletContext;
    
    public AdminPaginationRenderer() {
        
    }
    
    public void initVariables() {
        // 첫 페이지 버튼 - 관리자 스타일
        firstPageLabel = "<li class=\"inline-flex\">" +
                        "<button type=\"button\" onclick=\"{0}({1});return false;\" " +
                        "class=\"relative inline-flex items-center px-2 py-1 text-xs font-medium text-gray-500 bg-white border border-gray-300 rounded-l-md hover:bg-gray-50 hover:text-gray-700 hover:border-gray-400 focus:z-10 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-200 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-150\">" +
                        "<svg class=\"w-3 h-3\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">" +
                        "<path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M11 19l-7-7 7-7m8 14l-7-7 7-7\"></path>" +
                        "</svg>" +
                        "<span class=\"sr-only\">처음</span>" +
                        "</button>" +
                        "</li>";
        
        // 이전 페이지 버튼
        previousPageLabel = "<li class=\"inline-flex\">" +
                           "<button type=\"button\" onclick=\"{0}({1});return false;\" " +
                           "class=\"relative inline-flex items-center px-2 py-1 text-xs font-medium text-gray-500 bg-white border border-gray-300 hover:bg-gray-50 hover:text-gray-700 hover:border-gray-400 focus:z-10 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-200 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-150\">" +
                           "<svg class=\"w-3 h-3\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">" +
                           "<path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M15 19l-7-7 7-7\"></path>" +
                           "</svg>" +
                           "<span class=\"sr-only\">이전</span>" +
                           "</button>" +
                           "</li>";
        
        // 현재 페이지 (활성화된 상태) - 관리자 테마 색상
        currentPageLabel = "<li class=\"inline-flex\">" +
                          "<span class=\"relative inline-flex items-center px-3 py-1 text-xs font-semibold text-white bg-blue-600 border border-blue-600 cursor-default\">" +
                          "{0}" +
                          "</span>" +
                          "</li>";
        
        // 다른 페이지 번호들 - 관리자 스타일
        otherPageLabel = "<li class=\"inline-flex\">" +
                        "<button type=\"button\" onclick=\"{0}({1});return false;\" " +
                        "class=\"relative inline-flex items-center px-3 py-1 text-xs font-medium text-gray-700 bg-white border border-gray-300 hover:bg-gray-50 hover:text-gray-900 hover:border-gray-400 focus:z-10 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-200 transition-all duration-150\">" +
                        "{2}" +
                        "</button>" +
                        "</li>";
        
        // 다음 페이지 버튼
        nextPageLabel = "<li class=\"inline-flex\">" +
                       "<button type=\"button\" onclick=\"{0}({1});return false;\" " +
                       "class=\"relative inline-flex items-center px-2 py-1 text-xs font-medium text-gray-500 bg-white border border-gray-300 hover:bg-gray-50 hover:text-gray-700 hover:border-gray-400 focus:z-10 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-200 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-150\">" +
                       "<svg class=\"w-3 h-3\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">" +
                       "<path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M9 5l7 7-7 7\"></path>" +
                       "</svg>" +
                       "<span class=\"sr-only\">다음</span>" +
                       "</button>" +
                       "</li>";
        
        // 마지막 페이지 버튼
        lastPageLabel = "<li class=\"inline-flex\">" +
                       "<button type=\"button\" onclick=\"{0}({1});return false;\" " +
                       "class=\"relative inline-flex items-center px-2 py-1 text-xs font-medium text-gray-500 bg-white border border-gray-300 rounded-r-md hover:bg-gray-50 hover:text-gray-700 hover:border-gray-400 focus:z-10 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-200 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-150\">" +
                       "<svg class=\"w-3 h-3\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">" +
                       "<path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M13 5l7 7-7 7M5 5l7 7-7 7\"></path>" +
                       "</svg>" +
                       "<span class=\"sr-only\">마지막</span>" +
                       "</button>" +
                       "</li>";
    }

    public void setServletContext(ServletContext servletContext) {
        this.servletContext = servletContext;
        initVariables();
    }
} 