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.PromoSource;
import jakarta.persistence.*;

import javax.validation.constraints.NotNull;
import java.util.Objects;

@Entity
@Table(name = "MST_PROMOUNITBERLAKU")
public class PromoUnitBerlaku implements EntityObject<PromoUnitBerlaku> {
    //
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    Integer id;

    @NotNull(message = "promo unit berlaku id cannot be null")
    private String PromoUnitBerlakuID;

    @NotNull(message = "unit category id cannot be null")
    private String unitCategoryID;

    private String unitCategoryName;

    @NotNull(message = "unit series id cannot be null")
    private String unitSeriesID;

    private String unitSeriesName;

    @NotNull(message = "unitType id cannot be null")
    private String unitTypeID;

    private String unitTypeName;

    @NotNull(message = "promoID cannot be null")
    private String promoID;

    @Enumerated(EnumType.STRING)
    private DataStatus promoUnitBerlakuStatus;

    @Embedded
    private CreationalSpecification promoUnitBerlakuCreational;

    @Enumerated(EnumType.STRING)
    private PromoSource source;

    public PromoUnitBerlaku() {

    }

    public PromoUnitBerlaku(String PromoUnitBerlakuID, String unitCategoryID, String unitCategoryName, String unitSeriesID, String unitSeriesName, String unitTypeID, String unitTypeName, String promoID, DataStatus promoUnitBerlakuStatus, PromoSource source, CreationalSpecification promoUnitBerlakuCreational) {
        this.PromoUnitBerlakuID = PromoUnitBerlakuID;
        this.unitCategoryID = unitCategoryID;
        this.unitCategoryName = unitCategoryName;
        this.unitSeriesID = unitSeriesID;
        this.unitSeriesName = unitSeriesName;
        this.unitTypeID = unitTypeID;
        this.unitTypeName = unitTypeName;
        this.promoID = promoID;
        this.promoUnitBerlakuStatus = promoUnitBerlakuStatus;
        this.source = source;
        this.promoUnitBerlakuCreational = promoUnitBerlakuCreational;
    }

    public String getUnitCategoryName() {
        return unitCategoryName;
    }

    public void setUnitCategoryName(String unitCategoryName) {
        this.unitCategoryName = unitCategoryName;
    }

    public String getUnitSeriesName() {
        return unitSeriesName;
    }

    public void setUnitSeriesName(String unitSeriesName) {
        this.unitSeriesName = unitSeriesName;
    }

    public String getUnitTypeName() {
        return unitTypeName;
    }

    public void setUnitTypeName(String unitTypeName) {
        this.unitTypeName = unitTypeName;
    }


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getPromoUnitBerlakuID() {
        return PromoUnitBerlakuID;
    }

    public void setPromoUnitBerlakuID(String PromoUnitBerlakuID) {
        this.PromoUnitBerlakuID = PromoUnitBerlakuID;
    }

    public String getUnitCategoryID() {
        return unitCategoryID;
    }

    public void setUnitCategoryID(String unitCategoryID) {
        this.unitCategoryID = unitCategoryID;
    }

    public String getUnitSeriesID() {
        return unitSeriesID;
    }

    public void setUnitSeriesID(String unitSeriesID) {
        this.unitSeriesID = unitSeriesID;
    }

    public String getUnitTypeID() {
        return unitTypeID;
    }

    public void setUnitTypeID(String unitTypeID) {
        this.unitTypeID = unitTypeID;
    }

    public String getPromoID() {
        return promoID;
    }

    public void setPromoID(String promoID) {
        this.promoID = promoID;
    }

    public DataStatus getPromoUnitBerlakuStatus() {
        return promoUnitBerlakuStatus;
    }

    public void setPromoUnitBerlakuStatus(DataStatus promoUnitBerlakuStatus) {
        this.promoUnitBerlakuStatus = promoUnitBerlakuStatus;
    }

    public CreationalSpecification getPromoUnitBerlakuCreational() {
        return promoUnitBerlakuCreational;
    }

    public void setPromoUnitBerlakuCreational(CreationalSpecification promoUnitBerlakuCreational) {
        this.promoUnitBerlakuCreational = promoUnitBerlakuCreational;
    }

    public PromoSource getSource() {
        return source;
    }

    public void setSource(PromoSource source) {
        this.source = source;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 37 * hash + Objects.hashCode(this.id);
        hash = 37 * hash + Objects.hashCode(this.PromoUnitBerlakuID);
        hash = 37 * hash + Objects.hashCode(this.unitCategoryID);
        hash = 37 * hash + Objects.hashCode(this.unitCategoryName);
        hash = 37 * hash + Objects.hashCode(this.unitSeriesID);
        hash = 37 * hash + Objects.hashCode(this.unitSeriesName);
        hash = 37 * hash + Objects.hashCode(this.unitTypeID);
        hash = 37 * hash + Objects.hashCode(this.unitTypeName);
        hash = 37 * hash + Objects.hashCode(this.promoID);
        hash = 37 * hash + Objects.hashCode(this.promoUnitBerlakuStatus);
        hash = 37 * hash + Objects.hashCode(this.promoUnitBerlakuCreational);
        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 PromoUnitBerlaku other = (PromoUnitBerlaku) obj;
        if (!Objects.equals(this.PromoUnitBerlakuID, other.PromoUnitBerlakuID)) {
            return false;
        }
        if (!Objects.equals(this.unitCategoryID, other.unitCategoryID)) {
            return false;
        }
        if (!Objects.equals(this.unitCategoryName, other.unitCategoryName)) {
            return false;
        }
        if (!Objects.equals(this.unitSeriesID, other.unitSeriesID)) {
            return false;
        }
        if (!Objects.equals(this.unitSeriesName, other.unitSeriesName)) {
            return false;
        }
        if (!Objects.equals(this.unitTypeID, other.unitTypeID)) {
            return false;
        }
        if (!Objects.equals(this.unitTypeName, other.unitTypeName)) {
            return false;
        }
        if (!Objects.equals(this.promoID, other.promoID)) {
            return false;
        }
        if (!Objects.equals(this.id, other.id)) {
            return false;
        }
        if (this.promoUnitBerlakuStatus != other.promoUnitBerlakuStatus) {
            return false;
        }
        if (!Objects.equals(this.promoUnitBerlakuCreational, other.promoUnitBerlakuCreational)) {
            return false;
        }
        return true;
    }

    @Override
    public boolean sameIdentityAs(PromoUnitBerlaku t) {
        return this.equals(t);
    }
}