package cokr.xit.ens.biz.iup.signtalk.presentation;

import cokr.xit.ens.biz.iup.signtalk.model.IupSigntalkReqVO;
import cokr.xit.ens.biz.iup.signtalk.service.IupSigntalkService;
import cokr.xit.ens.core.aop.EnsResponseVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "iupSigntalkController")
@Slf4j
@RequiredArgsConstructor
@RestController
public class IupSigntalkController {

    private final IupSigntalkService iupSigntalkService;

    @Operation(summary = "접수")
    @PostMapping(value = "/iup/signtalk/accept", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<EnsResponseVO> accept(@RequestBody IupSigntalkReqVO reqDTO){
        EnsResponseVO responseVO = iupSigntalkService.accept(reqDTO.getLnkInputId());
        return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
    }
    @Operation(summary = "접수(일괄)")
    @PostMapping(value = "/iup/signtalk/accept/all", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<EnsResponseVO> acceptAll(){
        EnsResponseVO responseVO = iupSigntalkService.acceptAll();
        return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
    }

//    @Operation(summary = "제작")
////    @PutMapping(value = "/iup/signtalk/re/make", produces = MediaType.APPLICATION_JSON_VALUE)
//    @PostMapping(value = "/iup/signtalk/re/make", produces = MediaType.APPLICATION_JSON_VALUE)
//    public ResponseEntity<EnsResponseVO> reMake(@RequestBody iupSigntalkReqVO reqDTO){
//        EnsResponseVO responseVO = iupMydocService.reMake(reqDTO.getLnkInputId());
//        return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
//    }

    @Operation(summary = "전송")
//    @PutMapping(value = "/iup/signtalk/re/send", produces = MediaType.APPLICATION_JSON_VALUE)
    @PostMapping(value = "/iup/signtalk/re/send", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<EnsResponseVO> reSend(@RequestBody IupSigntalkReqVO reqDTO){
        EnsResponseVO responseVO = iupSigntalkService.reSend(reqDTO.getLnkInputId());
        return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
    }

    @Operation(summary = "전송결과가져오기")
    @PostMapping(value = "/iup/signtalk/fetch", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<EnsResponseVO> fetch(@RequestBody IupSigntalkReqVO reqDTO){
        EnsResponseVO responseVO = iupSigntalkService.fetch(reqDTO.getLnkInputId());
        return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
    }
    @Operation(summary = "전송결과가져오기(일괄)")
    @PostMapping(value = "/iup/signtalk/fetch/all", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<EnsResponseVO> fetchAll(){
        EnsResponseVO responseVO = iupSigntalkService.fetchAll();
        return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
    }
}
