package com.iqser.red.service.persistence.service.v1.api.external.resource;

import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
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.pdftron.redaction.v1.api.model.highlights.Highlights;
import com.iqser.red.service.persistence.service.v1.api.shared.model.AnnotationIds;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;

public interface HighlightsResource {

    String HIGHLIGHTS_PATH = "/highlights";
    String IMPORTED_REDACTIONS_PATH = "/imported-redactions";
    String CONVERT_PATH = "/convert";
    String DELETE_PATH = "/delete";

    String DOSSIERS_PATH = ExternalApi.BASE_PATH + "/dossiers";
    String FILES_PATH = "/files";

    String DOSSIER_ID = "dossierId";
    String FILE_ID = "fileId";

    String DOSSIER_ID_PATH_VARIABLE = "/{" + DOSSIER_ID + "}";
    String FILE_ID_PATH_VARIABLE = "/{" + FILE_ID + "}";


    @ResponseStatus(value = HttpStatus.OK)
    @Operation(summary = "Gets available highlights for the file", description = "None")
    @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
    @GetMapping(value = DOSSIERS_PATH + DOSSIER_ID_PATH_VARIABLE + FILES_PATH + FILE_ID_PATH_VARIABLE + HIGHLIGHTS_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
    Highlights getHighlights(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);


    @ResponseStatus(value = HttpStatus.NO_CONTENT)
    @Operation(summary = "Converts highlights to imported redactions", description = "None")
    @ApiResponses(value = {@ApiResponse(responseCode = "204", description = "OK")})
    @PostMapping(value = DOSSIERS_PATH + DOSSIER_ID_PATH_VARIABLE + FILES_PATH + FILE_ID_PATH_VARIABLE + HIGHLIGHTS_PATH + CONVERT_PATH, consumes = MediaType.APPLICATION_JSON_VALUE)
    void convertHighlights(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody AnnotationIds annotationIds);


    @ResponseStatus(value = HttpStatus.NO_CONTENT)
    @Operation(summary = "Removed highlights from the file", description = "None")
    @ApiResponses(value = {@ApiResponse(responseCode = "204", description = "OK")})
    @PostMapping(value = DOSSIERS_PATH + DOSSIER_ID_PATH_VARIABLE + FILES_PATH + FILE_ID_PATH_VARIABLE + HIGHLIGHTS_PATH + DELETE_PATH, consumes = MediaType.APPLICATION_JSON_VALUE)
    void deleteHighlights(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody AnnotationIds annotationIds);


    @ResponseStatus(value = HttpStatus.NO_CONTENT)
    @Operation(summary = "Deletes wrong imported redactions for a file", description = "None")
    @ApiResponses(value = {@ApiResponse(responseCode = "204", description = "OK")})
    @PostMapping(value = DOSSIERS_PATH + DOSSIER_ID_PATH_VARIABLE + FILES_PATH + FILE_ID_PATH_VARIABLE + IMPORTED_REDACTIONS_PATH + DELETE_PATH, consumes = MediaType.APPLICATION_JSON_VALUE)
    void deleteImportedRedactions(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId, @RequestBody AnnotationIds annotationIds);

}
