class RetourPrefectureService {

    public void receiveAnomalieEnveloppe(AnomalieEnveloppe anomalieEnveloppe, Attachment attachment) {
        String[] splited = attachment.getFilename().split("--");
        splited = Arrays.copyOfRange(splited, 1, splited.length);
        String sourceTarGz = String.join("--", splited).replace(".xml", ".tar.gz");
        ActeHistory acteHistorySource = acteHistoryRepository.findFirstByFileNameContaining(sourceTarGz)
                .orElseThrow(ActeNotFoundException::new);
        Acte acte = acteRepository.findByUuidAndDraftNull(acteHistorySource.getActeUuid())
                .orElseThrow(ActeNotFoundException::new);
        publishActeHistory(acte.getUuid(), StatusType.NACK_RECEIVED, attachment,
                Optional.of(anomalieEnveloppe.getDetail()), Optional.empty());
    }

    public  RetourPrefectureService(ActeRepository acteRepository, ActeHistoryRepository acteHistoryRepository,
                                   LocalAuthorityRepository localAuthorityRepository, ApplicationEventPublisher applicationEventPublisher, ZipGeneratorUtil zipGeneratorUtil);

}