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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;

import com.iqser.red.service.search.v1.model.SearchRequest;
import com.iqser.red.service.search.v1.model.SearchResult;

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 SearchResource {

    String SEARCH_PATH = ExternalApi.BASE_PATH + "/search-v2";
    String SEARCH_PATH_DEPRECATED = ExternalApi.BASE_PATH + "/search";


    @ResponseBody
    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = SEARCH_PATH, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    @Operation(summary = "Search for contents of documents", description = "None")
    @ApiResponses(value = @ApiResponse(responseCode = "200", description = "OK"))
    SearchResult search(@RequestBody SearchRequest searchRequest);


    @Deprecated
    @ResponseBody
    @ResponseStatus(value = HttpStatus.OK)
    @PostMapping(value = SEARCH_PATH_DEPRECATED, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    @Operation(summary = "Search for contents of documents", description = "None")
    @ApiResponses(value = @ApiResponse(responseCode = "200", description = "OK"))
    SearchResult searchDeprecated(@RequestBody SearchRequest searchRequest);

}
