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

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

    private final KkoMydocHisService kkoMydocHisService;


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

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

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

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

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

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

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

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

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

}
