package com.sonymusic.dx.persistence.gras;

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

import java.io.Serializable;

@Embeddable
public class SongCountryPk implements Serializable {

    private static final long serialVersionUID = 1L;

    @Column(name = "song_no", nullable = false)
    private Long songNumber;

    @Column(name = "country_key", nullable = false, length = 3, insertable = false, updatable = false)
    private String countryKey;

    public Long getSongNumber() {
        return songNumber;
    }

    public void setSongNumber(Long songNumber) {
        this.songNumber = songNumber;
    }

    public String getCountryKey() {
        return countryKey;
    }

    public void setCountryKey(String countryKey) {
        this.countryKey = countryKey;
    }

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

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (!(obj instanceof SongCountryPk))
            return false;
        SongCountryPk other = (SongCountryPk) obj;
        if (getSongNumber() == null) {
            if (other.getSongNumber() != null)
                return false;
        } else if (!getSongNumber().equals(other.getSongNumber()))
            return false;
        if (getCountryKey() == null) {
            if (other.getCountryKey() != null)
                return false;
        } else if (!getCountryKey().equals(other.getCountryKey()))
            return false;
        return true;
    }
}

