package com.xisc.pm.domain.entity;

import com.fasterxml.jackson.annotation.JsonInclude;
import io.choerodon.mybatis.annotation.ModifyAudit;
import io.choerodon.mybatis.annotation.VersionAudit;
import io.choerodon.mybatis.domain.AuditDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Objects;


/**
 * 以优充次静态表(PmHtolStatic)实体类
 *
 * @author 纪文桃 wentao.ji01@hand-china.com
 * @since 2024-07-25 10:07:37
 */

@Getter
@Setter
@ApiModel("以优充次静态表")
@VersionAudit
@ModifyAudit
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@Table(name = "PM_HTOL_STATIC")
public class PmHtolStatic extends AuditDomain implements Serializable {
    private static final long serialVersionUID = 255053370463796070L;

    public static final String FIELD_PM_HTOL_STATIC_ID = "pmHtolStaticId";
    public static final String FIELD_MAIN_BACKLOG_CODE = "mainBacklogCode";
    public static final String FIELD_BETTER_ST_NO = "betterStNo";
    public static final String FIELD_WORSE_ST_NO = "worseStNo";
    public static final String FIELD_BETTER_TO_WORSE_SEQ = "betterToWorseSeq";
    public static final String FIELD_VALID_FLAG = "validFlag";
    public static final String FIELD_REMARK = "remark";
    public static final String FIELD_TENANT_ID = "tenantId";
    public static final String FIELD_ATTRIBUTE1 = "attribute1";
    public static final String FIELD_ATTRIBUTE2 = "attribute2";
    public static final String FIELD_ATTRIBUTE3 = "attribute3";
    public static final String FIELD_ATTRIBUTE4 = "attribute4";
    public static final String FIELD_ATTRIBUTE5 = "attribute5";

    @Id
    @GeneratedValue
    private Long pmHtolStaticId;

    @ApiModelProperty(value = "厂别")
    private String mainBacklogCode;

    @ApiModelProperty(value = "优内部钢种")
    private String betterStNo;

    @ApiModelProperty(value = "次内部钢种")
    private String worseStNo;

    @ApiModelProperty(value = "以优充次顺序码")
    private Long betterToWorseSeq;

    @ApiModelProperty(value = "生效标记")
    private String validFlag;

    @Transient
    @ApiModelProperty(value = "生效标记含义")
    private String validFlagDesc;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "租户ID", required = true)
    @NotNull
    private Long tenantId;

    private String attribute1;

    private String attribute2;

    private String attribute3;

    private String attribute4;

    private String attribute5;


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        PmHtolStatic that = (PmHtolStatic) o;
        return Objects.equals(mainBacklogCode, that.mainBacklogCode) && Objects.equals(betterStNo, that.betterStNo) &&
                Objects.equals(worseStNo, that.worseStNo) && Objects.equals(betterToWorseSeq, that.betterToWorseSeq) &&
                Objects.equals(validFlag, that.validFlag) && Objects.equals(validFlagDesc, that.validFlagDesc) &&
                Objects.equals(remark, that.remark) && Objects.equals(tenantId, that.tenantId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mainBacklogCode, betterStNo, worseStNo, betterToWorseSeq, validFlag, validFlagDesc, remark, tenantId);
    }
}
