package com.yonge.cooleshow.admin.io.request.im;

import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.List;
import java.util.Optional;

/**
 * 系统IM通知信息
 * Created by Eric.Shang on 2022/9/20.
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class IMNotifyMessageVO implements Serializable {

    @ApiModelProperty(value = "发送者ID")
    private String sender;

    @ApiModelProperty(value = "接收ID")
    private List<String> receives;

    @ApiModelProperty(value = "通知标题")
    private String title;

    @ApiModelProperty(value = "文件通知消息")
    private String txtMessage;

    @ApiModelProperty(value = "图片通知消息")
    private String imgMessage;

    @ApiModelProperty(value = "图片文件地址")
    private String imgUrl;

    public String jsonString() {

        return JSON.toJSONString(this);
    }

    public boolean invalidRequestParam() {

        return StringUtils.isEmpty(getSender())
                || StringUtils.isAllBlank(getTxtMessage(), getImgMessage());
    }
}
