package cokr.xit.ens.modules.nvsigntalk.presentation;

import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.modules.nvsigntalk.service.NvSigntalkHisService;
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.RestController;

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

    private final NvSigntalkHisService nvSigntalkHisService;


    @Operation(summary = "전송요청이력 영구 삭제")
    @PostMapping(value = "/nv/signtalk/trunc/req/his", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<EnsResponseVO> truncateReqHis() {

        EnsResponseVO responseVO = EnsResponseVO.okBuilder()
                .resultInfo(nvSigntalkHisService.truncateReqHist() + " truncate completed")
                .build();

        return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
    }

    @Operation(summary = "토큰검증요청이력 영구 삭제")
    @PostMapping(value = "/nv/signtalk/trunc/token/his", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<EnsResponseVO> truncateTokenHis() {

        EnsResponseVO responseVO = EnsResponseVO.okBuilder()
                .resultInfo(nvSigntalkHisService.truncateTokenHist() + " truncate completed")
                .build();

        return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
    }

    @Operation(summary = "상태변경요청이력 영구 삭제")
    @PostMapping(value = "/nv/signtalk/trunc/stat/his", produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<EnsResponseVO> truncateStatHis() {

        EnsResponseVO responseVO = EnsResponseVO.okBuilder()
                .resultInfo(nvSigntalkHisService.truncateStatHist() + " truncate completed")
                .build();

        return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
    }

}
