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

import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.modules.ktsigntalk.gibis.service.KtGibisHisService;
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 = "KtGibisHisController")
@Slf4j
@RequiredArgsConstructor
@RestController
public class KtGibisHisController {

    private final KtGibisHisService ktGibisHisService;


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

        EnsResponseVO responseVO = ktGibisHisService.truncateReqHist();

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

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

        EnsResponseVO responseVO = ktGibisHisService.truncateTokenHist();

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

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

        EnsResponseVO responseVO = ktGibisHisService.truncateStatHist();

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

}
