package com.yonge.cooleshow.biz.dal.wrapper.im;

import com.alibaba.fastjson.JSON;
import com.yonge.toolset.base.page.QueryInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;
import java.util.Optional;

/**
 * 客服群发接收
 * 2022-12-09 10:49:10
 */
@ApiModel(value = "CustomerServiceReceiveWrapper对象", description = "客服群发接收查询对象")
public class CustomerServiceReceiveWrapper {

    @Data
	@Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" CustomerServiceReceiveQuery-客服群发接收")
    public static class CustomerServiceReceiveQuery extends QueryInfo {
    
        @ApiModelProperty("关键字匹配")
		private String keyword;

        @ApiModelProperty("群发消息ID")
        private Long batchSendingId;
        
        public String getKeyword() {
            return Optional.ofNullable(keyword).filter(StringUtils::isNotBlank).orElse(null);
        }
        
        public String jsonString() {
            return JSON.toJSONString(this);
        }

        public static CustomerServiceReceiveQuery from(String json) {
            return JSON.parseObject(json, CustomerServiceReceiveQuery.class);
        }
    }  

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
	@ApiModel(" CustomerServiceReceive-客服群发接收")
    public static class CustomerServiceReceive {

        @ApiModelProperty("主键ID")
        private Long id;

        @ApiModelProperty("群发消息ID")
        private Long batchSendingId;

        @ApiModelProperty("用户ID")
        private Long userId;

        @ApiModelProperty("用户身份")
        private String clientType;

        @ApiModelProperty("创建时间")
        private Date createTime;

        @ApiModelProperty("用户名称")
        private String userName;
        
        public String jsonString() {
            return JSON.toJSONString(this);
        }

        public static CustomerServiceReceive from(String json) {
            return JSON.parseObject(json, CustomerServiceReceive.class);
        }
	}

}