package sgc.portal.com.com.web;

import org.springframework.web.bind.annotation.*;
import sgc.portal.base.util.EasyHashMap;
import sgc.portal.com.com.dto.ApprovalSearch;
import sgc.portal.com.com.model.Approval;
import sgc.portal.com.com.service.ComApprovalPopService;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/com/com")
public class ComApprovalPopController {
    private final ComApprovalPopService service;

    public ComApprovalPopController(ComApprovalPopService service) {
        this.service = service;
    }
    
    /*
     * 조회 LIST
     */
    @PostMapping("/ComApprovalPop/list")
    public List<EasyHashMap<String, Object>> getList(@RequestBody ApprovalSearch search) {
        return service.getList(search);
    }
    
    /*
     * 최근결재정보 조회 LIST
     */
    @PostMapping("/ComApprovalPop/getList1")
    public List<EasyHashMap<String, Object>> getList1(@RequestBody ApprovalSearch search) {
        return service.getList1(search);
    }
    
    /*
     * draft
     */
    @PostMapping("/ComApprovalPop/draft")
    public Map<String, String> draft(@RequestBody List<Approval> approval) {
    	return service.draft(approval);
    }
    
    /*
     * approval
     */
    @PostMapping("/ComApprovalPop/approval")
    public Map<String, String> approval(@RequestBody List<Approval> approval) {
    	return service.approval(approval);
    }
    
    /*
     * return
     */
    @PostMapping("/ComApprovalPop/return")
    public Map<String, String> reject(@RequestBody List<Approval> approval) {
    	return service.reject(approval);
    }
    
    /*
     * 최근 결재내역 조회 LIST
     */
    @PostMapping("/ComApprovalPop/getLastAprvList")
    public List<EasyHashMap<String, Object>> getLastAprvList(@RequestBody ApprovalSearch search) {
        return service.getLastAprvList(search);
    }
    
}
