package cokr.xit.ens.modules.ktsigntalk.direct.presentation;

import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.modules.ktsigntalk.direct.service.KtSigntalkHisService;
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.GetMapping;
import org.springframework.web.bind.annotation.RestController;

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

    private final KtSigntalkHisService ktSigntalkHisService;


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

        EnsResponseVO responseVO = ktSigntalkHisService.truncateReqHist();

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

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

        EnsResponseVO responseVO = ktSigntalkHisService.truncateTokenHist();

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

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

        EnsResponseVO responseVO = ktSigntalkHisService.truncateStatHist();

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

}
