package com.engine.salary.web;

import com.engine.common.util.ServiceUtil;
import com.engine.salary.entity.process.dto.SalaryAdjustmentDTO;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.wrapper.ProcessWrapper;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;

/**
 * 流程相关
 * <p>Copyright: Copyright (c) 2022</p>
 * <p>Company: 泛微软件</p>
 *
 * @author qiantao
 * @version 1.0
 **/
public class ProcessController {

    private ProcessWrapper getProcessWrapper(User user) {
        return ServiceUtil.getService(ProcessWrapper.class, user);
    }

    /**
     * 发起调薪流程信息
     * @param request
     * @param response
     * @return
     */
    @GET
    @Path("/salaryAdjustmentInfo")
    @Produces(MediaType.APPLICATION_JSON)
    public String getSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
        User user = HrmUserVarify.getUser(request, response);
        return new ResponseResult<Map<String, Object>, SalaryAdjustmentDTO>(user).run(getProcessWrapper(user)::salaryAdjustment);
    }


}
