package com.sonymusic.dx.persistence.gras;

import jakarta.persistence.*;
import org.hibernate.type.YesNoConverter;

import java.io.Serializable;

@Entity
@Table(name = "vgras361")
@IdClass(RecordingProjectParticipantPk.class)
public class RecordingProjectParticipant extends RAASClientSpecificEntity implements Serializable {
    private static final long serialVersionUID = 1L;

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

    @Id
    @Column(name = "rec_project_id", nullable = false, updatable = false, insertable = false)
    private Long recordingProjectId;

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

    @Column(name = "associated_to", length = 250)
    private String associatedTo;

    @Column(name = "include_on_product_flag", nullable = false, length = 1)
    @Convert(converter = YesNoConverter.class)
    private boolean includeOnProduct;

    @Column(name = "include_on_track_flag", nullable = false, length = 1)
    @Convert(converter = YesNoConverter.class)
    private boolean includeOnTrack;

    @Column(name = "is_confidential", nullable = false, length = 1)
    @Convert(converter = YesNoConverter.class)
    private boolean isConfidential;

    @Column(name = "is_prod_main_artist_flag", nullable = false, length = 1)
    @Convert(converter = YesNoConverter.class)
    private boolean isProductMainArtist;

    @Column(name = "is_tr_main_artist_flag", nullable = false, length = 1)
    @Convert(converter = YesNoConverter.class)
    private boolean isTrackMainArtist;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "link_word_key")
    private ArtworkLinkingWord linkWord;

    @Column(name = "mod_particip_name", length = 250)
    private String modifiedParticipName;

    @Column(name = "mod_task_type_name", length = 250)
    private String modifiedTaskTypeName;

    @Column(name = "seq_no", nullable = false)
    private Long sequenceNo;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "task_type_key")
    private TaskType taskType;

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "rec_project_id", insertable = false, updatable = false)
    private RecordingProject recordingProject;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "particip_no", insertable = false, updatable = false)
    private Participant participant;

    @Column(name = "is_prod_primary_artist", length = 1)
    @Convert(converter = YesNoConverter.class)
    private Boolean isProductPrimArtist;

    @Column(name = "is_tr_primary_artist", length = 1)
    @Convert(converter = YesNoConverter.class)
    private Boolean isTrackPrimArtist;

    public Boolean getIsProductPrimArtist() {
        return isProductPrimArtist;
    }

    public void setIsProductPrimArtist(Boolean isProductPrimArtist) {
        this.isProductPrimArtist = isProductPrimArtist;
    }

    public Boolean getIsTrackPrimArtist() {
        return isTrackPrimArtist;
    }

    public void setIsTrackPrimArtist(Boolean isTrackPrimArtist) {
        this.isTrackPrimArtist = isTrackPrimArtist;
    }

    public Long getIdNo() {
        return idNo;
    }

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

    public String getAssociatedTo() {
        return associatedTo;
    }

    public void setAssociatedTo(String associatedTo) {
        this.associatedTo = associatedTo;
    }

    public boolean isIncludeOnProduct() {
        return includeOnProduct;
    }

    public void setIncludeOnProduct(boolean includeOnProduct) {
        this.includeOnProduct = includeOnProduct;
    }

    public boolean isIncludeOnTrack() {
        return includeOnTrack;
    }

    public void setIncludeOnTrack(boolean includeOnTrack) {
        this.includeOnTrack = includeOnTrack;
    }

    public boolean isConfidential() {
        return isConfidential;
    }

    public void setConfidential(boolean isConfidential) {
        this.isConfidential = isConfidential;
    }

    public boolean isProductMainArtist() {
        return isProductMainArtist;
    }

    public void setProductMainArtist(boolean isProductMainArtist) {
        this.isProductMainArtist = isProductMainArtist;
    }

    public boolean isTrackMainArtist() {
        return isTrackMainArtist;
    }

    public void setTrackMainArtist(boolean isTrackMainArtist) {
        this.isTrackMainArtist = isTrackMainArtist;
    }

    public ArtworkLinkingWord getLinkWord() {
        return linkWord;
    }

    public void setLinkWord(ArtworkLinkingWord linkWord) {
        this.linkWord = linkWord;
    }

    public String getModifiedParticipName() {
        return modifiedParticipName;
    }

    public void setModifiedParticipName(String modifiedParticipName) {
        this.modifiedParticipName = modifiedParticipName;
    }

    public String getModifiedTaskTypeName() {
        return modifiedTaskTypeName;
    }

    public void setModifiedTaskTypeName(String modifiedTaskTypeName) {
        this.modifiedTaskTypeName = modifiedTaskTypeName;
    }

    public Long getSequenceNo() {
        return sequenceNo;
    }

    public void setSequenceNo(Long sequenceNo) {
        this.sequenceNo = sequenceNo;
    }

    public TaskType getTaskType() {
        return taskType;
    }

    public void setTaskType(TaskType taskType) {
        this.taskType = taskType;
    }

    public RecordingProject getRecordingProject() {
        return recordingProject;
    }

    public void setRecordingProject(RecordingProject recordingProject) {
        this.recordingProject = recordingProject;
    }

    public Participant getParticipant() {
        return participant;
    }

    public void setParticipant(Participant participant) {
        this.participant = participant;
    }

    protected Long getParticipantNo() {
        return participantNo;
    }

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

    protected Long getRecordingProjectId() {
        return recordingProjectId;
    }

    protected void setRecordingProjectId(Long recordingProjectId) {
        this.recordingProjectId = recordingProjectId;
    }

    @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 + ((getRecordingProjectId() == null) ? 0 : getRecordingProjectId().hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (!(obj instanceof RecordingProjectParticipant))
            return false;
        RecordingProjectParticipant other = (RecordingProjectParticipant) 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 (getRecordingProjectId() == null) {
            if (other.getRecordingProjectId() != null)
                return false;
        } else if (!getRecordingProjectId().equals(other.getRecordingProjectId()))
            return false;
        return true;
    }

}