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.DeleteMapping;
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.notification.NotificationPreferences;

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

    String NOTIFICATION_PREFERENCES = ExternalApi.BASE_PATH + "/notification-preferences";


    @ResponseBody
    @ResponseStatus(value = HttpStatus.OK)
    @Operation(summary = "Returns object containing the currently enabled notifications.")
    @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
    @GetMapping(value = NOTIFICATION_PREFERENCES, produces = MediaType.APPLICATION_JSON_VALUE)
    NotificationPreferences getNotificationPreferences();


    @ResponseStatus(value = HttpStatus.NO_CONTENT)
    @Operation(summary = "Create/update notifications for the current user")
    @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
    @PostMapping(value = NOTIFICATION_PREFERENCES, consumes = MediaType.APPLICATION_JSON_VALUE)
    void setNotificationPreferences(@RequestBody NotificationPreferences notificationPreferences);


    @ResponseStatus(value = HttpStatus.NO_CONTENT)
    @Operation(summary = "Create/update notifications for the current user")
    @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
    @DeleteMapping(value = NOTIFICATION_PREFERENCES)
    void deleteNotificationPreferences();

}
