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

import com.alibaba.fastjson.JSON;
import com.microsvc.toolkit.common.response.paging.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-11-26 10:55:18
 */
@ApiModel(value = "ImGroupNoticeWrapper对象", description = "群公告查询对象")
public class ImGroupNoticeWrapper {

    @Data
	@Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @ApiModel(" ImGroupNoticeQuery-群公告")
    public static class ImGroupNoticeQuery implements QueryInfo {
    
    	@ApiModelProperty("当前页")
        private Integer page;
        
        @ApiModelProperty("分页行数")
        private Integer rows;
        
        @ApiModelProperty("关键字匹配")
		private String keyword;

        @ApiModelProperty("群组ID")
        private String groupId;

        @ApiModelProperty("删除标记")
        private Boolean delFlag;

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

        public Boolean getDelFlag() {
            return Optional.ofNullable(delFlag).orElse(false);
        }

        public String getKeyword() {
            return Optional.ofNullable(keyword).filter(StringUtils::isNotBlank).orElse(null);
        }
    }

    @Data
	@Builder
    @NoArgsConstructor
    @AllArgsConstructor
	@ApiModel(" ImGroupNotice-群公告")
    public static class ImGroupNotice {

                
		@ApiModelProperty("主键") 
		private Long id;
                        
		@ApiModelProperty("群组ID") 
		private String groupId;
                        
		@ApiModelProperty("标题") 
		private String title;
                        
		@ApiModelProperty("内容") 
		private String content;
                        
		@ApiModelProperty("是否置顶") 
		private Boolean topFlag;
                        
		@ApiModelProperty("是否发送给新人") 
		private Boolean sentToNewMemberFlag;
                        
		@ApiModelProperty("操作人") 
		private Long operatorId;

        @ApiModelProperty("操作用户身份")
        private String clientType;
                        
		@ApiModelProperty("是否删除1是0否;") 
		private Boolean delFlag;
                        
		@ApiModelProperty("修改时间") 
		private Date updateTime;
                        
		@ApiModelProperty("创建时间") 
		private Date createTime;

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

}