package com.eksad.masterdata.domain; import com.eksad.ddms.common.util.object.EntityObject; import com.eksad.ddms.common.util.status.DataStatus; import com.eksad.masterdata.common.listEnum.SatuanType; import jakarta.persistence.*; import javax.validation.constraints.NotNull; import java.util.Objects; @Entity @Table(name = "MST_PROMODISCOUNTPART") public class PromoDiscountPart implements EntityObject { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) Integer id; @NotNull(message = "promo discount part id") private String promoDiscountPartID; @NotNull(message = "promo id cannot be null") private String promoID; // private String discountID; // this field from H3 no longger use @NotNull(message = "discount part id cannot be null") private String discountPartID; private String discountPartDesc; private String discountPartGroup; @Enumerated(EnumType.STRING) private SatuanType satuan; private Double nilaiDiscount; @Enumerated(EnumType.STRING) private DataStatus promoDiscountPartStatus; @Embedded private CreationalSpecification promoCreationalSpecification; public PromoDiscountPart(String promoDiscountPartID, String promoID, String discountPartID, String discountPartDesc, String discountPartGroup, SatuanType satuan, Double nilaiDiscount, DataStatus promoDiscountPartStatus, CreationalSpecification promoCreationalSpecification) { this.promoDiscountPartID = promoDiscountPartID; this.promoID = promoID; // this.discountID = discountID; this.discountPartID = discountPartID; this.discountPartDesc = discountPartDesc; this.discountPartGroup = discountPartGroup; this.satuan = satuan; this.nilaiDiscount = nilaiDiscount; this.promoDiscountPartStatus = promoDiscountPartStatus; this.promoCreationalSpecification = promoCreationalSpecification; } public PromoDiscountPart() { } public String getPromoDiscountPartID() { return promoDiscountPartID; } public void setPromoDiscountPartID(String promoDiscountPartID) { this.promoDiscountPartID = promoDiscountPartID; } public String getPromoID() { return promoID; } public void setPromoID(String promoID) { this.promoID = promoID; } public String getDiscountPartID() { return discountPartID; } public void setDiscountPartID(String discountPartID) { this.discountPartID = discountPartID; } public DataStatus getPromoDiscountPartStatus() { return promoDiscountPartStatus; } public void setPromoDiscountPartStatus(DataStatus promoDiscountPartStatus) { this.promoDiscountPartStatus = promoDiscountPartStatus; } public CreationalSpecification getPromoCreationalSpecification() { return promoCreationalSpecification; } public void setPromoCreationalSpecification(CreationalSpecification promoCreationalSpecification) { this.promoCreationalSpecification = promoCreationalSpecification; } public String getDiscountPartDesc() { return discountPartDesc; } public void setDiscountPartDesc(String discountPartDesc) { this.discountPartDesc = discountPartDesc; } public SatuanType getSatuan() { return satuan; } public void setSatuan(SatuanType satuan) { this.satuan = satuan; } public Double getNilaiDiscount() { return nilaiDiscount; } public void setNilaiDiscount(Double nilaiDiscount) { this.nilaiDiscount = nilaiDiscount; } // public String getDiscountID() { // return discountID; // } // // public void setDiscountID(String discountID) { // this.discountID = discountID; // } public String getDiscountPartGroup() { return discountPartGroup; } public void setDiscountPartGroup(String discountPartGroup) { this.discountPartGroup = discountPartGroup; } @Override public int hashCode() { int hash = 5; hash = 29 * hash + Objects.hashCode(this.promoDiscountPartID); hash = 29 * hash + Objects.hashCode(this.promoID); // hash = 29 * hash + Objects.hashCode(this.discountID); hash = 29 * hash + Objects.hashCode(this.discountPartID); hash = 29 * hash + Objects.hashCode(this.discountPartDesc); hash = 29 * hash + Objects.hashCode(this.satuan); hash = 29 * hash + Objects.hashCode(this.nilaiDiscount); hash = 29 * hash + Objects.hashCode(this.promoDiscountPartStatus); hash = 29 * hash + Objects.hashCode(this.promoCreationalSpecification); hash = 29 * hash + Objects.hashCode(this.discountPartGroup); return hash; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final PromoDiscountPart other = (PromoDiscountPart) obj; if (!Objects.equals(this.promoDiscountPartID, other.promoDiscountPartID)) { return false; } if (!Objects.equals(this.promoID, other.promoID)) { return false; } // if (!Objects.equals(this.discountID, other.discountID)) { // return false; // } if (!Objects.equals(this.discountPartID, other.discountPartID)) { return false; } if (!Objects.equals(this.discountPartDesc, other.discountPartDesc)) { return false; } if (this.satuan != other.satuan) { return false; } if (!Objects.equals(this.nilaiDiscount, other.nilaiDiscount)) { return false; } if (this.promoDiscountPartStatus != other.promoDiscountPartStatus) { return false; } if (!Objects.equals(this.promoCreationalSpecification, other.promoCreationalSpecification)) { return false; } if (!Objects.equals(this.discountPartGroup, other.discountPartGroup)) { return false; } return true; } @Override public boolean sameIdentityAs(PromoDiscountPart t) { return this.equals(t); } }