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

import java.util.List;
import java.util.Map;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;

import com.iqser.red.service.persistence.service.v1.api.shared.model.VersionsResponse;

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

@ResponseStatus(value = HttpStatus.OK)
public interface VersionsResource {

    String VERSION_REST_PATH = ExternalApi.BASE_PATH + "/version";
    String DOSSIER_TEMPLATE_PARAMETER_NAME = "dossierTemplateId";
    String DOSSIER_TEMPLATE_PATH_PARAM = "/{" + DOSSIER_TEMPLATE_PARAMETER_NAME + "}";

    String DOSSIER_REST_PATH = "/dossier";
    String DOSSIER_ID_PARAM = "dossierId";
    String DOSSIER_ID_PATH_PARAM = "/{" + DOSSIER_ID_PARAM + "}";


    @GetMapping(value = VERSION_REST_PATH)
    @Operation(summary = "Retrieves current versions.", description = "None")
    @ApiResponse(responseCode = "200", description = "Successfully retrieved versions.")
    Map<String, VersionsResponse> getVersions(@RequestParam(DOSSIER_TEMPLATE_PARAMETER_NAME) List<String> dossierTemplateIds);


    @GetMapping(value = VERSION_REST_PATH + DOSSIER_REST_PATH + DOSSIER_TEMPLATE_PATH_PARAM + DOSSIER_ID_PATH_PARAM)
    @Operation(summary = "Retrieves current version for dossier dictionary.", description = "None")
    @ApiResponse(responseCode = "200", description = "Successfully retrieved versions.")
    Long getDossierDictionaryVersion(@PathVariable(DOSSIER_TEMPLATE_PARAMETER_NAME) String dossierTemplateId, @PathVariable(DOSSIER_ID_PARAM) String dossierId);

}
