package com.pandoli365.bibimbap.abstracts;

import jakarta.servlet.http.HttpSession;

public abstract class Service<Req extends Request, Res extends Result> {

    public boolean is_login = false;

    public abstract Res StartService(HttpSession session, Req request);

    public Res ChackService(HttpSession session, Req request){
        if (is_login && session.getAttribute("id") == null)
            return (Res) new ErrorResult(401);
        if(request != null && !request.IsReceivedAllField())
            return (Res) new ErrorResult(401);
        return StartService(session, request);
    }
}
