package com.ecep.contract.model;

import java.io.Serializable;
import java.time.LocalDate;
import java.util.Objects;

import com.ecep.contract.util.HibernateProxyUtils;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 合格供应商名录
 * 每年一条记录
 * 下有 item 和 file
 */
@Getter
@Setter
@Entity
@Table(name = "COMPANY_VENDOR_APPROVED")
@ToString
public class CompanyVendorApprovedList implements IdentityEntity, Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "ID", nullable = false)
    private Integer id;
    /**
     * 标题
     */
    @Column(name = "TITLE")
    private String title;

    /**
     * 发布日期
     */
    @Column(name = "PUBLISH_DATE")
    private LocalDate publishDate;

    /**
     * 文件夹路径
     */
    @Column(name = "PATH")
    private String path;

    /**
     * 备注
     */
    @Column(name = "DESCRIPTION")
    private String description;

    @Override
    public final boolean equals(Object object) {
        if (this == object)
            return true;
        if (object == null)
            return false;
        if (HibernateProxyUtils.isNotEffectiveClassEquals(object, this)) {
            return false;
        }
        CompanyVendorApprovedList that = (CompanyVendorApprovedList) object;
        return getId() != null && Objects.equals(getId(), that.getId());
    }

    @Override
    public final int hashCode() {
        return HibernateProxyUtils.hashCode(this);
    }
}
