package com.madeu.crm.procedureReview.ctrl;

import com.madeu.init.ManagerDraftAction;
import com.madeu.crm.procedureReview.dto.ProcedureReviewDTO;
import com.madeu.crm.procedureReview.svc.ProcedureReviewService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.multipart.MultipartFile;

@Slf4j
@RestController
public class ProcedureReviewController extends ManagerDraftAction {

    @Autowired
    private ProcedureReviewService procedureReviewService;

    @RequestMapping(value = "/procedureReview/moveProcedureReviewList.do")
    public ModelAndView moveProcedureReviewList() throws Exception {
        return new ModelAndView("/crm/procedureReview/procedureReviewSelectList");
    }

    @RequestMapping(value = "/procedureReview/getProcedureReviewList.do")
    public ProcedureReviewDTO getProcedureReviewList(@RequestBody ProcedureReviewDTO paramDTO) throws Exception {
        return procedureReviewService.getProcedureReviewList(paramDTO);
    }

    @RequestMapping(value = "/procedureReview/getProcedureReview.do")
    public ProcedureReviewDTO getProcedureReview(@RequestBody ProcedureReviewDTO paramDTO) throws Exception {
        return procedureReviewService.getProcedureReview(paramDTO);
    }

    @RequestMapping(value = "/procedureReview/getCategoryList.do")
    public ProcedureReviewDTO getCategoryList(@RequestBody ProcedureReviewDTO paramDTO) throws Exception {
        return procedureReviewService.getCategoryList(paramDTO);
    }

    @RequestMapping(value = "/procedureReview/putProcedureReviewFile.do")
    public ProcedureReviewDTO putProcedureReviewFile(@RequestParam(value = "file", required = false) MultipartFile file,
            @ModelAttribute ProcedureReviewDTO paramDTO) throws Exception {
        return procedureReviewService.putProcedureReviewFile(file, paramDTO);
    }

    @RequestMapping(value = "/procedureReview/moveProcedureReviewInsert.do")
    public ModelAndView moveProcedureReviewInsert() throws Exception {
        return new ModelAndView("/crm/procedureReview/procedureReviewInsert");
    }

    @RequestMapping(value = "/procedureReview/putProcedureReview.do")
    public ProcedureReviewDTO putProcedureReview(@RequestBody ProcedureReviewDTO paramDTO) throws Exception {
        return procedureReviewService.putProcedureReview(paramDTO);
    }

    @RequestMapping(value = "/procedureReview/moveProcedureReviewUpdate.do")
    public ModelAndView moveProcedureReviewUpdate() throws Exception {
        return new ModelAndView("/crm/procedureReview/procedureReviewUpdate");
    }

    @RequestMapping(value = "/procedureReview/modProcedureReview.do")
    public ProcedureReviewDTO modProcedureReview(@RequestBody ProcedureReviewDTO paramDTO) throws Exception {
        return procedureReviewService.modProcedureReview(paramDTO);
    }

    @RequestMapping(value = "/procedureReview/delProcedureReview.do")
    public ProcedureReviewDTO delProcedureReview(@RequestBody ProcedureReviewDTO paramDTO) throws Exception {
        return procedureReviewService.delProcedureReview(paramDTO);
    }
}
