package com.xinelu.manage.domain.subscribemessagerecord;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseDomain;
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.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 微信小程序订阅消息记录对象 subscribe_message_record
 *
 * @author xinyilu
 * @date 2023-03-14
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "微信小程序订阅消息记录对象", description = "subscribe_message_record")
public class SubscribeMessageRecord extends BaseDomain implements Serializable {
    private static final long serialVersionUID = -474969938563834831L;
    /**
     * 主键id
     */
    private Long id;

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

    /**
     * 微信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 templateId;

    /**
     * 订阅消息类型，消费提醒：CONSUME_MESSAGE_PUSH，优惠券到期提醒：COUPON_EXPIRE_MESSAGE_PUSH，积分过期提醒：INTEGRAL_EXPIRE_MESSAGE_PUSH
     */
    @ApiModelProperty(value = "订阅消息类型，消费提醒：CONSUME_MESSAGE_PUSH，优惠券到期提醒：COUPON_EXPIRE_MESSAGE_PUSH，积分过期提醒：INTEGRAL_EXPIRE_MESSAGE_PUSH")
    @Excel(name = "订阅消息类型，消费提醒：CONSUME_MESSAGE_PUSH，优惠券到期提醒：COUPON_EXPIRE_MESSAGE_PUSH，积分过期提醒：INTEGRAL_EXPIRE_MESSAGE_PUSH")
    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;

    /**
     * 微信小程序账户id
     */
    private String appletId;

    /**
     * 订阅状态，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("unionid", getUnionid())
                .append("openid", getOpenid())
                .append("templateId", getTemplateId())
                .append("messageType", getMessageType())
                .append("subscribeCount", getSubscribeCount())
                .append("subscribeTime", getSubscribeTime())
                .append("appletId", getAppletId())
                .append("subscribeStatus", getSubscribeStatus())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}
