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

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

    private final KkoAlimtalkHisService kkoAlimtalkHisService;


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

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

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

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

        EnsResponseVO responseVO = EnsResponseVO.okBuilder()
                .resultInfo(kkoAlimtalkHisService.truncateRsltHist() + " truncate completed")
                .build();

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

}
