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

import cokr.xit.ens.modules.kkomydoc.domain.repository.SendDetailKkoMydocReqHistRepository;
import cokr.xit.ens.modules.kkomydoc.domain.repository.SendDetailKkoMydocStatHistRepository;
import cokr.xit.ens.modules.kkomydoc.domain.repository.SendDetailKkoMydocTokenHistRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public class KkoMydocHisService {
    private final SendDetailKkoMydocReqHistRepository sendDetailKkoMydocReqHistRepository;
    private final SendDetailKkoMydocTokenHistRepository sendDetailKkoMydocTokenHistRepository;
    private final SendDetailKkoMydocStatHistRepository sendDetailKkoMydocStatHistRepository;


    /**
     * 전송요청이력 영구 삭제
     *
     * @return
     */
    public Long truncateReqHist() {
        Long totCnt = sendDetailKkoMydocReqHistRepository.count();
        sendDetailKkoMydocReqHistRepository.truncate();

        return totCnt;
    }

    /**
     * 토큰검증요청이력 영구 삭제
     *
     * @return
     */
    public Long truncateTokenHist() {
        Long totCnt = sendDetailKkoMydocTokenHistRepository.count();
        sendDetailKkoMydocTokenHistRepository.truncate();

        return totCnt;
    }

    /**
     * 상태변경요청이력 영구 삭제
     *
     * @return
     */
    public Long truncateStatHist() {
        Long totCnt = sendDetailKkoMydocStatHistRepository.count();
        sendDetailKkoMydocStatHistRepository.truncate();

        return totCnt;
    }


}
