package com.sonymusic.dx.persistence.gras;

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

import java.io.Serializable;

@Embeddable
public class SplitDealPrimaryPk implements Serializable {

    private static final long serialVersionUID = 1L;

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

    @Column(name = "rep_owner_key", nullable = false, length = 250)
    private String repOwner;

    public SplitDealPrimaryPk() {}

    public SplitDealPrimaryPk(Long dealNo, String repOwner) {
        this.dealNo = dealNo;
        this.repOwner = repOwner;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((dealNo == null) ? 0 : dealNo.hashCode());
        result = prime * result + ((repOwner == null) ? 0 : repOwner.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;
        SplitDealPrimaryPk other = (SplitDealPrimaryPk) obj;
        if (dealNo == null) {
            if (other.dealNo != null)
                return false;
        } else if (!dealNo.equals(other.dealNo))
            return false;
        if (repOwner == null) {
            if (other.repOwner != null)
                return false;
        } else if (!repOwner.equals(other.repOwner))
            return false;
        return true;
    }

}

