/*
* Copyright (C) 2008-2017, Juick
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package com.juick.service;
import com.juick.Message;
import com.juick.Reaction;
import com.juick.User;
import com.juick.model.ResponseReply;
import java.net.URI;
import java.util.*;
/**
* Created by aalexeev on 11/13/16.
*/
public interface MessagesService {
int createMessage(int uid, String txt, String attachment, Collection tags);
int createReply(int mid, int rid, User user, String txt, String attachment);
int getReplyIDIncrement(int mid);
enum RecommendStatus {
Error,
Added,
Deleted
}
RecommendStatus recommendMessage(int mid, int vuid, String userUri);
RecommendStatus recommendMessage(int mid, int vuid);
List listReactions();
RecommendStatus likeMessage(int mid, int vuid, int reactionId);
RecommendStatus likeMessage(int mid, int vuid, int reactionId, String userUri);
boolean canViewThread(int mid, int uid);
boolean isReadOnly(int mid);
boolean isSubscribed(int uid, int mid);
int getMessagePrivacy(int mid);
Optional getMessage(int mid);
com.juick.Message getReply(int mid, int rid);
com.juick.Message getReplyByUri(String replyUri);
User getMessageAuthor(int mid);
List getMessageRecommendations(int mid);
List getAll(int visitorUid, int before);
List getTag(int tid, int visitorUid, int before, int cnt);
List getTags(String tids, int visitorUid, int before, int cnt);
List getPlace(int placeId, int visitorUid, int before);
List getMyFeed(int uid, int before, boolean recommended);
List getPrivate(int uid, int before);
List getDiscussions(int uid, Long to);
List getRecommended(int uid, int before);
List getPopular(int visitorUid, int before);
List getPhotos(int visitorUid, int before);
List getSearch(User visitor, String search, int page);
List getUserBlog(int uid, int privacy, int before);
List getUserTag(int uid, int tid, int privacy, int before);
List getUserBlogAtDay(int uid, int privacy, int daysback);
List getUserBlogWithRecommendations(int uid, int privacy, int before);
List getUserRecommendations(int uid, int before);
List getUserPhotos(int uid, int privacy, int before);
List getUserSearch(User visitor, int UID, String search, int privacy, int page);
List getMessages(User visitor, List mids);
Map> updateReactionsFor(final List mid);
List getReplies(User user, int mid);
boolean setMessagePopular(int mid, int popular);
boolean setMessagePrivacy(int mid);
boolean deleteMessage(int uid, int mid);
boolean deleteReply(int uid, int mid, int rid);
List getLastMessages(int hours);
List getLastReplies(int hours);
List getPopularCandidates();
void setLastReadComment(User user, Integer mid, Integer rid);
void setRead(User user, Integer mid);
List getUnread(User user);
boolean updateMessage(Integer mid, Integer rid, String body);
boolean updateReplyUri(Message reply, URI replyUri);
boolean replyExists(URI replyUri);
boolean deleteReply(URI userUri, URI replyUri);
}