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.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.persistence.service.v1.api.shared.model.dossiertemplate.configuration.ApplicationConfig;

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

public interface ApplicationConfigurationResource {

    String APPLICATION_CONFIG_PATH = ExternalApi.BASE_PATH + "/app-config";


    @ResponseBody
    @ResponseStatus(value = HttpStatus.CREATED)
    @PostMapping(value = APPLICATION_CONFIG_PATH, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    @Operation(summary = "Creates or updated the application configuration.", description = "None")
    @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK.")})
    ApplicationConfig createOrUpdateAppConfig(@Valid @RequestBody ApplicationConfig appConfig);


    @ResponseBody
    @ResponseStatus(value = HttpStatus.OK)
    @GetMapping(value = APPLICATION_CONFIG_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
    @Operation(summary = "Retrieves the current application configuration.", description = "None")
    @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK.")})
    ApplicationConfig getCurrentApplicationConfig();

}
