package digital.laboratory.platform.entrustment.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import digital.laboratory.platform.common.mybatis.base.BaseEntity;
import lombok.Data;

import java.time.LocalDate;

/**
 * 申请修改委托消息表
 * @TableName b_entrust_alter_apply
 */
@Data
@TableName(value ="b_entrust_alter_apply")
public class EntrustAlterApply extends BaseEntity {
    /**
     * 主键标识
     */
    @TableId(value = "ID", type = IdType.ASSIGN_ID)
    private String id;

    /**
     * 关联的委托id
     */
    private String entrustId;

    /**
     * 申请人id
     */
    private String applicant;

    /**
     * 申请日期
     */
    private LocalDate applyDate;

    /**
     * 申请原因
     */
    private String applyReason;

    /**
     * 申请单位
     */
    private String applyOrgId;

    /**
     * 审核人id 
     */
    private String reviewer;

    /**
     * 状态 === 0 待提交申请， 1 提交申请待审核，2申请通过，-1 申请不通过，9 申请已完成
     */
    private Integer status;

    /**
     * 原因
     */
    private String reason;

    /**
     * 更新操作记录，记录着更改前的信息和更改后的信息
     */
    private String updateRecord;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        EntrustAlterApply other = (EntrustAlterApply) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getEntrustId() == null ? other.getEntrustId() == null : this.getEntrustId().equals(other.getEntrustId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getEntrustId() == null) ? 0 : getEntrustId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", entrustId=").append(entrustId);
        sb.append(", applicant=").append(applicant);
        sb.append(", applyDate=").append(applyDate);
        sb.append(", applyOrgId=").append(applyOrgId);
        sb.append(", reviewer=").append(reviewer);
        sb.append(", status=").append(status);
        sb.append(", reason=").append(reason);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}