package com.xinelu.manage.domain.officialaccounttemplateevent;

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.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.time.LocalDateTime;

/**
 * 微信公众号模板信息事件推送对象 official_account_template_event
 *
 * @author xinelu
 * @date 2024-03-25
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "微信公众号模板信息事件推送对象", description = "official_account_template_event")
public class OfficialAccountTemplateEvent extends BaseEntity {
    private static final long serialVersionUID = -8437491233815143821L;
    /**
     * 主键id
     */
    private Long id;

    /**
     * 患者信息表id
     */
    @ApiModelProperty(value = "患者信息表id")
    @Excel(name = "患者信息表id")
    private Long patientId;

    /**
     * 患者姓名
     */
    @ApiModelProperty(value = "患者姓名")
    @Excel(name = "患者姓名")
    private String patientName;

    /**
     * 微信公众号openid
     */
    @ApiModelProperty(value = "微信用户openid")
    @Excel(name = "微信用户openid")
    private String openid;

    /**
     * 微信公众号id
     */
    @ApiModelProperty(value = "微信公众号id")
    @Excel(name = "微信公众号id")
    private String officialAccountAppId;

    /**
     * 发送时间，即：事件创建时间，yyyy-MM-dd HH:mm:ss
     */
    @ApiModelProperty(value = "发送时间，即：事件创建时间，yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "发送时间，即：事件创建时间，yyyy-MM-dd HH:mm:ss", width = 30, dateFormat = "yyyy-MM-dd")
    private LocalDateTime sendTime;

    /**
     * 消息类型是事件，固定取值为：event
     */
    @ApiModelProperty(value = "消息类型是事件，固定取值为：event")
    @Excel(name = "消息类型是事件，固定取值为：event")
    private String msgType;

    /**
     * 事件为模板消息发送结束，固定取值为：TEMPLATESENDJOBFINISH
     */
    @ApiModelProperty(value = "事件为模板消息发送结束，固定取值为：TEMPLATESENDJOBFINISH")
    @Excel(name = "事件为模板消息发送结束，固定取值为：TEMPLATESENDJOBFINISH")
    private String eventType;

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

    /**
     * 发送状态,成功：success，用户拒绝接收：failed:user block，发送失败（非用户拒绝）：failed:system failed
     */
    @ApiModelProperty(value = "发送状态,成功：success，用户拒绝接收：failed:user block，发送失败")
    @Excel(name = "发送状态,成功：success，用户拒绝接收：failed:user block，发送失败", readConverterExp = "非=用户拒绝")
    private String status;


    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("patientId", getPatientId())
                .append("patientName", getPatientName())
                .append("openid", getOpenid())
                .append("officialAccountAppId", getOfficialAccountAppId())
                .append("sendTime", getSendTime())
                .append("msgType", getMsgType())
                .append("eventType", getEventType())
                .append("msgId", getMsgId())
                .append("status", getStatus())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}
