package com.cm.websocket.service;

import com.cm.common.exception.SearchException;
import com.cm.common.result.SuccessResult;
import com.cm.websocket.exception.SessionException;
import com.cm.websocket.pojo.AppSocketMessage;
import com.cm.websocket.pojo.vos.message.NoticeVO;

import javax.websocket.Session;
import java.util.List;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: IMessageService
 * @Description: 消息
 * @Author: wanggeng
 * @Date: 2021/1/14 3:28 下午
 * @Version: 1.0
 */
public interface IMessageService {
    /**
     * 发送消息
     *
     * @param appId appId
     * @return
     */
    SuccessResult sendByAppId(String appId);

    /**
     * 发送跳转目标消息
     *
     * @param appId
     * @param target 目标，页面或者是页面的标识
     * @return
     */
    SuccessResult sendByAppIdTarget(String appId, String target);

    /**
     * 通知消息
     *
     * @param noticeVO
     * @param save
     * @return
     * @throws SearchException
     */
    SuccessResult saveNoticeWithTarget(NoticeVO noticeVO, boolean save) throws Exception;

    /**
     * 群发文本消息
     *
     * @param fromSession
     * @param appSocketMessage
     */
    void sendGroupTextMessage(Session fromSession, AppSocketMessage appSocketMessage) throws SessionException;

    /**
     * 删除通知
     *
     * @param serviceIds
     */
    void delete(List<String> serviceIds);
}
