package com.iqser.red.service.persistence.service.v1.api.internal.resources;

import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseStatus;

import com.iqser.red.service.persistence.service.v1.api.shared.model.AnalyzeResult;
import com.iqser.red.service.persistence.service.v1.api.shared.model.UntouchedDocumentResponse;
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.dossier.file.FileErrorInfo;

public interface FileStatusProcessingUpdateResource {

    String STATUS_PATH = "/status-updates";
    String DOSSIER_ID_PARAM = "dossierId";
    String DOSSIER_ID_PATH_PARAM = "/{" + DOSSIER_ID_PARAM + "}";

    String FILE_ID = "fileId";
    String FILE_ID_PATH_VARIABLE = "/{" + FILE_ID + "}";


    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/preprocessing-successful", consumes = MediaType.APPLICATION_JSON_VALUE)
    void preprocessingSuccessful(@PathVariable(DOSSIER_ID_PARAM) String dossierId,
                                 @PathVariable(FILE_ID) String fileId,
                                 @RequestBody UntouchedDocumentResponse untouchedDocumentResponse);

    @Deprecated
    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/preprocessing-failed")
    void preprocessingFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId);

    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/preprocessing-failed-error")
    void preprocessingFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId,
                             @RequestBody FileErrorInfo fileErrorInfo);


    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/analysis-successful", consumes = MediaType.APPLICATION_JSON_VALUE)
    void analysisSuccessful(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody AnalyzeResult analyzeResult);


    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/ocr-successful")
    void ocrSuccessful(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId);


    @Deprecated
    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/analysis-failed")
    void analysisFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId);


    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/analysis-failed-error")
    void analysisFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId,
                        @RequestBody FileErrorInfo fileErrorInfo);


    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/pre-processing")
    void preProcessing(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId);


    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/ocr-processing")
    void ocrProcessing(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId);


    @Deprecated
    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/ocr-failed")
    void ocrFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId);


    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/ocr-failed-error")
    void ocrFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId,
                   @RequestBody FileErrorInfo fileErrorInfo);


    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/indexing")
    void indexing(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId);


    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/indexing-successful")
    void indexingSuccessful(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId);


    @Deprecated
    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/indexing-failed")
    void indexingFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId);


    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = InternalApi.BASE_PATH + STATUS_PATH + DOSSIER_ID_PATH_PARAM + FILE_ID_PATH_VARIABLE + "/indexing-failed-error")
    void indexingFailed(@PathVariable(DOSSIER_ID_PARAM) String dossierId, @PathVariable(FILE_ID) String fileId,
                        @RequestBody FileErrorInfo fileErrorInfo);

}
