package com.xinelu.manage.domain.subscribemessagerecord;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 微信小程序订阅消息记录对象 subscribe_message_record
 *
 * @author xinelu
 * @date 2024-03-18
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "微信小程序订阅消息记录对象", description = "subscribe_message_record")
public class SubscribeMessageRecord extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    private Long id;

    /**
     * 会员id
     */
    @ApiModelProperty(value = "会员id")
    @Excel(name = "会员id")
    private Long patientId;

    /**
     * 签约患者管理任务节点表id
     */
    @ApiModelProperty(value = "签约患者管理任务节点表id")
    @Excel(name = "签约患者管理任务节点表id")
    private Long manageRouteNodeId;

    /**
     * 微信unionid标识
     */
    @ApiModelProperty(value = "微信unionid标识")
    @Excel(name = "微信unionid标识")
    private String unionid;

    /**
     * 微信小程序的openid
     */
    @ApiModelProperty(value = "微信小程序的openid")
    @Excel(name = "微信小程序的openid")
    private String openid;

    /**
     * 微信小程序账户id
     */
    @ApiModelProperty(value = "微信小程序账户id")
    @Excel(name = "微信小程序账户id")
    private String appletId;

    /**
     * 消息模板id
     */
    @ApiModelProperty(value = "消息模板id")
    @Excel(name = "消息模板id")
    private String templateId;

    /**
     * 订阅任务消息类型，电话外呼：PHONE_OUTBOUND，问卷量表：QUESTIONNAIRE_SCALE，宣教文章：PROPAGANDA_ARTICLE，文字提醒：TEXT_REMIND，人工随访：ARTIFICIAL_FOLLOW_UP
     */
    @ApiModelProperty(value = "订阅任务消息类型，电话外呼：PHONE_OUTBOUND，问卷量表：QUESTIONNAIRE_SCALE，宣教文章：PROPAGANDA_ARTICLE，文字提醒：TEXT_REMIND，人工随访：ARTIFICIAL_FOLLOW_UP")
    @Excel(name = "订阅任务消息类型，电话外呼：PHONE_OUTBOUND，问卷量表：QUESTIONNAIRE_SCALE，宣教文章：PROPAGANDA_ARTICLE，文字提醒：TEXT_REMIND，人工随访：ARTIFICIAL_FOLLOW_UP")
    private String messageType;

    /**
     * 用于订阅消息次数
     */
    @ApiModelProperty(value = "用于订阅消息次数")
    @Excel(name = "用于订阅消息次数")
    private Integer subscribeCount;

    /**
     * 订阅时间
     */
    @ApiModelProperty(value = "订阅时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "订阅时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime subscribeTime;

    /**
     * 订阅状态，accept：接受，reject：拒绝
     */
    @ApiModelProperty(value = "订阅状态，ACCEPT：接受，REJECT：拒绝")
    @Excel(name = "订阅状态，ACCEPT：接受，REJECT：拒绝")
    private String subscribeStatus;


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        SubscribeMessageRecord that = (SubscribeMessageRecord) o;
        return Objects.equals(openid, that.openid) && Objects.equals(templateId, that.templateId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(openid, templateId);
    }


    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("patientId", getPatientId())
                .append("manageRouteNodeId", getManageRouteNodeId())
                .append("unionid", getUnionid())
                .append("openid", getOpenid())
                .append("appletId", getAppletId())
                .append("templateId", getTemplateId())
                .append("messageType", getMessageType())
                .append("subscribeCount", getSubscribeCount())
                .append("subscribeTime", getSubscribeTime())
                .append("subscribeStatus", getSubscribeStatus())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}
