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.license.RedactionLicenseModel;

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

    String LICENSE_REST_PATH = ExternalApi.BASE_PATH + "/license";


    @ResponseStatus(value = HttpStatus.NO_CONTENT)
    @PostMapping(value = LICENSE_REST_PATH, consumes = MediaType.APPLICATION_JSON_VALUE)
    @Operation(summary = "Takes Update the current license")
    @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "License update successful.")})
    void updateLicense(@RequestBody RedactionLicenseModel licenseModel);


    @ResponseBody
    @ResponseStatus(value = HttpStatus.OK)
    @GetMapping(value = LICENSE_REST_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
    @Operation(summary = "Returns the current license ( or a demo license in case none is configured")
    @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "License returned successfully.")})
    RedactionLicenseModel getLicense();

}
