package org.apache.rave.portal.model;

import org.apache.rave.model.MenuHasNutrientPK;

import javax.persistence.Column;
import javax.persistence.Id;
import java.io.Serializable;

/**
 * Created by fhernandez on 22/10/14.
 */
public class JpaMenuHasNutrientPK implements Serializable, MenuHasNutrientPK {

    @Id
    @Column(name = "menu_id", nullable = false, insertable = true, updatable = true, length = 19, precision = 0)
    private Long menuId;

    @Id
    @Column(name = "nutrient_id", nullable = false, insertable = true, updatable = true, length = 19, precision = 0)
    private Long nutrientId;


    @Override
    public Long getMenuId() {
        return menuId;
    }

    @Override
    public void setMenuId(Long menuId) {
        this.menuId = menuId;
    }

    @Override
    public Long getNutrientId() {
        return nutrientId;
    }

    @Override
    public void setNutrientId(Long nutrientId) {
        this.nutrientId = nutrientId;
    }



    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        JpaMenuHasNutrientPK that = (JpaMenuHasNutrientPK) o;

        if (menuId != that.menuId) return false;
        if (nutrientId != that.nutrientId) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (menuId ^ (menuId >>> 32));
        result = 31 * result + (int) (nutrientId ^ (nutrientId >>> 32));
        return result;
    }
}
