001/*
002 * Copyright 2020 Global Biodiversity Information Facility (GBIF)
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.gbif.api.service.collections;
017
018import org.gbif.api.model.collections.CollectionEntity;
019import org.gbif.api.model.collections.suggestions.ChangeSuggestion;
020import org.gbif.api.model.collections.suggestions.Status;
021import org.gbif.api.model.collections.suggestions.Type;
022import org.gbif.api.model.common.paging.Pageable;
023import org.gbif.api.model.common.paging.PagingResponse;
024
025import java.util.UUID;
026
027import javax.annotation.Nullable;
028import javax.validation.Valid;
029
030/** Defines the service to suggest changes in GRSciColl entities. */
031public interface ChangeSuggestionService<
032    T extends CollectionEntity, R extends ChangeSuggestion<T>> {
033
034  int createChangeSuggestion(@Valid R changeSuggestion);
035
036  void updateChangeSuggestion(@Valid R changeSuggestion);
037
038  void discardChangeSuggestion(int key);
039
040  // returns the entity created if applies
041  UUID applyChangeSuggestion(int key);
042
043  R getChangeSuggestion(int key);
044
045  PagingResponse<R> list(
046      @Nullable Status status,
047      @Nullable Type type,
048      @Nullable String proposedBy,
049      @Nullable UUID entityKey,
050      @Nullable Pageable page);
051}