package com.sonymusic.dx.persistence.gras;

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

import java.io.Serializable;

@Embeddable
public class TrackParticipantPk implements Serializable {

    private static final long serialVersionUID = 1L;

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

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

    @Column(name = "particip_no", nullable = false)
    private Long participantNo;

    @Column(name = "task_type_key", nullable = false, length = 3)
    private String taskTypeKey;

    @Column(name = "id_no", nullable = false)
    private Long idNo;

    protected TrackParticipantPk() {
        if (trackExt == null)
            trackExt = "  ";
    }

    public TrackParticipantPk(String trackNo, String trackExt, Long participantNo, String taskTypeKey, Long idNo) {
        this.trackNo = trackNo;
        this.trackExt = trackExt;
        this.participantNo = participantNo;
        this.taskTypeKey = taskTypeKey;
        this.idNo = idNo;
    }

    public String getTrackNo() {
        return trackNo;
    }

    public void setTrackNo(String trackNo) {
        this.trackNo = trackNo;
    }

    public String getTrackExt() {
        return trackExt;
    }

    public void setTrackExt(String trackExt) {
        this.trackExt = trackExt;
    }

    public Long getParticipantNo() {
        return participantNo;
    }

    public void setParticipantNo(Long participantNo) {
        this.participantNo = participantNo;
    }

    public String getTaskTypeKey() {
        return taskTypeKey;
    }

    public void setTaskTypeKey(String taskTypeKey) {
        this.taskTypeKey = taskTypeKey;
    }

    public Long getIdNo() {
        return idNo;
    }

    public void setIdNo(Long idNo) {
        this.idNo = idNo;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getIdNo() == null) ? 0 : getIdNo().hashCode());
        result = prime * result + ((getParticipantNo() == null) ? 0 : getParticipantNo().hashCode());
        result = prime * result + ((getTaskTypeKey() == null) ? 0 : getTaskTypeKey().hashCode());
        result = prime * result + ((getTrackExt() == null) ? 0 : getTrackExt().hashCode());
        result = prime * result + ((getTrackNo() == null) ? 0 : getTrackNo().hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (!(obj instanceof TrackParticipantPk))
            return false;
        TrackParticipantPk other = (TrackParticipantPk) obj;
        if (getIdNo() == null) {
            if (other.getIdNo() != null)
                return false;
        } else if (!getIdNo().equals(other.getIdNo()))
            return false;
        if (getParticipantNo() == null) {
            if (other.getParticipantNo() != null)
                return false;
        } else if (!getParticipantNo().equals(other.getParticipantNo()))
            return false;
        if (getTaskTypeKey() == null) {
            if (other.getTaskTypeKey() != null)
                return false;
        } else if (!getTaskTypeKey().equals(other.getTaskTypeKey()))
            return false;
        if (getTrackExt() == null) {
            if (other.getTrackExt() != null)
                return false;
        } else if (!getTrackExt().equals(other.getTrackExt()))
            return false;
        if (getTrackNo() == null) {
            if (other.getTrackNo() != null)
                return false;
        } else if (!getTrackNo().equals(other.getTrackNo()))
            return false;
        return true;
    }

}
