package com.sonymusic.dx.persistence.gras;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;

import java.io.Serializable;

@Embeddable
public class TrackSplitDealPk implements Serializable {

    private static final long serialVersionUID = 1L;

    @Column(name = "track_no", nullable = false)
    private String trackNo;

    @Column(name = "track_ext", nullable = false)
    private String trackExt;

    @Column(name = "deal_no", nullable = false)
    private Long dealNo;

    public TrackSplitDealPk() {}

    public TrackSplitDealPk(String trackNo, String trackExt, Long dealNo) {
        this.trackNo = trackNo;
        this.trackExt = trackExt;
        this.dealNo = dealNo;
    }

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

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        TrackSplitDealPk other = (TrackSplitDealPk) obj;
        if (dealNo == null) {
            if (other.dealNo != null)
                return false;
        } else if (!dealNo.equals(other.dealNo))
            return false;
        if (trackExt == null) {
            if (other.trackExt != null)
                return false;
        } else if (!trackExt.equals(other.trackExt))
            return false;
        if (trackNo == null) {
            if (other.trackNo != null)
                return false;
        } else if (!trackNo.equals(other.trackNo))
            return false;
        return true;
    }

}
