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

import cokr.xit.ens.modules.nvsigntalk.domain.repository.SendDetailNvSigntalkReqHistRepository;
import cokr.xit.ens.modules.nvsigntalk.domain.repository.SendDetailNvSigntalkStatHistRepository;
import cokr.xit.ens.modules.nvsigntalk.domain.repository.SendDetailNvSigntalkTokenHistRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public class NvSigntalkHisService {
    private final SendDetailNvSigntalkReqHistRepository sendDetailNvSigntalkReqHistRepository;
    private final SendDetailNvSigntalkTokenHistRepository sendDetailNvSigntalkTokenHistRepository;
    private final SendDetailNvSigntalkStatHistRepository sendDetailNvSigntalkStatHistRepository;


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

        return totCnt;
    }

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

        return totCnt;
    }

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

        return totCnt;
    }


}
