package com.arrebol.taxiservicios.model.core;

import java.util.Objects;

public class UserHasPermission implements java.io.Serializable {

    private static final long serialVersionUID = 8554490251667416632L;

    private UserHasPermissionId id;
    private Permission permission;
    private User user;

    public UserHasPermission() {
    }

    /**
     *
     * @param id
     */
    public UserHasPermission(UserHasPermissionId id) {
        this.id = id;
    }

    /**
     *
     * @param id
     * @param permission
     * @param user
     */
    public UserHasPermission(UserHasPermissionId id, Permission permission, User user) {
        this.id = id;
        this.permission = permission;
        this.user = user;
    }

    /**
     *
     * @param permission
     */
    public UserHasPermission(Permission permission) {
        this.permission = permission;
    }

    public UserHasPermissionId getId() {
        return this.id;
    }

    public void setId(UserHasPermissionId id) {
        this.id = id;
    }

    public Permission getPermission() {
        return this.permission;
    }

    public void setPermission(Permission permission) {
        this.permission = permission;
    }

    public User getUser() {
        return this.user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final UserHasPermission other = (UserHasPermission) obj;
        if (!Objects.equals(this.id, other.id)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "UserHasPermission{" + "id=" + id + ", permission=" + permission + ", user=" + user + '}';
    }

}
