package com.goafanti.message.service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.goafanti.app.bo.IndexBo;
import com.goafanti.common.model.JpushEasemobAccount;
import com.goafanti.common.model.MessageConsumer;
import com.goafanti.common.model.MessageFromSystem;
import com.goafanti.common.model.MessageProducer;
import com.goafanti.core.mybatis.page.Pagination;
import com.goafanti.message.bo.AppMessageBo;
import com.goafanti.message.bo.MessageBo;
import com.goafanti.message.bo.MessageListBo;

public interface MessageService {
	/**
	 * 查找推送用户
	 * @param selectMap
	 * @param subject
	 * @return
	 */
	String selectSendUser(Map<Integer,String> selectMap,Integer type);
	/**
	 * 查询推送运营人员
	 * @param selectMap
	 * @param subject
	 * @return
	 */
	String selectSendAdmin(Map<Integer,String> selectMap,Integer type);
	
	/**
	 * 查询推荐内容
	 * @param selectMap
	 * @param type
	 * @return
	 */
	List<MessageFromSystem> selectRecommend(Map<Integer, String> selectMap,Integer type);
	
	/**
	 * 
	 * @param selectMap 
	 * @param title
	 * @param body
	 * @param subject
	 * @return
	 */
	int insertSystemMessage(Map<Integer, String> targetMap,Integer targetType,String title, String body, Integer subject,Date createTime,Integer isDraft);
	
	/**
	 * 同步消息
	 * @param uid
	 * @return
	 */
	List<MessageBo> selectSyncMessage(String uid);
	
	/**
	 * 更新消息表
	 * @param producerList
	 * @return
	 */
	public int updateMessageProducer(List<MessageProducer> producerList);
	
	/**
	 * 批量插生产表
	 * @param target
	 * @return
	 */
	public int insertBatchProducer(List<MessageProducer> target);
	
	/**
	 * 批量插入消费表
	 * @param target
	 * @return
	 */
	public int insertBatchConsumer(List<MessageConsumer> target);
	
	/**
	 * 绑定第三方账号
	 * @param jea
	 * @return
	 */
	public int updateJpushEasemobAccount(String uuid,String registrationId,String easemobName, String easemobPass);
	
	/**
	 * 新增第三方账号
	 * @param uuid
	 * @param easemobName 环信id
	 * @param easemobPass 环信密码
	 * @return
	 */
	public int addJpushEasemobAccount(String uuid,String uid,String easemobName,String easemobPass);
	
	/**
	 * 更新
	 * @param messageId
	 * @param uid
	 * @param readTime 
	 * @return
	 */
	public int updateMessageConsumer(String messageId);
	
	/**
	 * 生成推荐消息
	 * @param selectMap
	 * @param type
	 * @param subject
	 * @return
	 */
	public int insertRecommendMessage(Map<Integer, String> sourceMap, Integer sourceType, Map<Integer, String> targetMap,Integer targetType,Integer subject,Integer isDraft);
	
	/**
	 * 系统消息列表
	 * @param isDraft
	 * @return
	 */
	Pagination<MessageListBo> listSystemMessage(Integer isDraft,Integer subject,Integer pageNo,Integer pageSize);
	
	/**
	 * 更新消息
	 * @param messageId
	 * @param title
	 * @param body
	 * @return
	 */
	int updateSystemMessage(String messageId, String title, String body,Integer isDraft);
	
	/**
	 * 删除消息
	 * @param messageId
	 * @return
	 */
	int deleteSystemMessage(String messageId);
	
	/**
	 * 首页消息归类
	 * @return
	 */
	IndexBo selectMessageWithGroup();
	
	/**
	 * 读取个人消息列表
	 * @param subject 消息类型
	 * @param sourceType 推荐类型
	 * @return
	 */
	Pagination<MessageListBo> listPersonalMessage(Integer subject,Integer sourceType,Integer pageNo,Integer pageSize);
	
	/**
	 * 查看消息详情
	 * @param messageId
	 * @return
	 */
	MessageFromSystem selectSystemMessageDetail(String messageId);
	
	/**
	 * 查询第三方账号
	 * @param uid
	 * @return
	 */
	JpushEasemobAccount selectSynAccByUid(String uid);

	 Pagination<AppMessageBo> applistMessage(Integer pageNo, Integer pageSize);
	 AppMessageBo updateAppReadMessage(String id);
	int updateReadJpushMessage(String messageId);
		

	
}
