package samuelb.capripol;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import java.io.Serializable;
import java.util.Objects;

@Embeddable
public class GroupUserRolesID implements Serializable {

    @Column(name = "groupID")
    private Long groupID;

    @Column(name = "groupRoleID")
    private Long groupRoleID;
    
    @Column(name = "userID")
    private Long userID;
    
    private GroupUserRolesID() {}

    public GroupUserRolesID(Long groupRoleID, Long groupID, Long userID) {
        this.groupRoleID = groupRoleID;
        this.groupID = groupID;
        this.userID = userID;
    }

    public Long getGroupRoleID() {
        return groupRoleID;
    }

    public void setGroupRoleID(Long groupRoleID) {
        this.groupRoleID = groupRoleID;
    }

    public Long getGroupID() {
        return groupID;
    }

    public void setGroupID(Long groupID) {
        this.groupID = groupID;
    }

    public Long getUserID() {
        return userID;
    }

    public void setUserID(Long userID) {
        this.userID = userID;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass())
            return false;

        GroupUserRolesID that = (GroupUserRolesID) o;
        return Objects.equals(groupRoleID, that.groupRoleID) &&
                Objects.equals(groupID, that.groupID) &&
                Objects.equals(userID, that.userID);
    }

    @Override
    public int hashCode() {
        return Objects.hash(groupRoleID, groupID, userID);
    }
}
