001/*
002 * This file is part of the Keycloak Moodle authenticator
003 * Copyright (C) 2024 Michael N. Lipp
004 *
005 * This program is free software; you can redistribute it and/or modify it 
006 * under the terms of the GNU Lesser General Public License as published
007 * by the Free Software Foundation; either version 3 of the License, or 
008 * (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful, but 
011 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
012 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 
013 * License for more details.
014 *
015 * You should have received a copy of the GNU Lesser General Public License along 
016 * with this program; if not, see <http://www.gnu.org/licenses/>.
017 */
018
019package org.jdrupes.keycloak.moodleauth.moodle.model;
020
021import java.util.Objects;
022
023/**
024 * Models a Moodle user with the properties required in this context.
025 */
026@SuppressWarnings("PMD.DataClass")
027public class MoodleUser extends MoodleErrorValues {
028
029    private long id;
030    private String lastname;
031    private String firstname;
032    private String fullname;
033    private String email;
034
035    /**
036     * @return the id
037     */
038    public long getId() {
039        return id;
040    }
041
042    /**
043     * @param id the id to set
044     */
045    public void setId(long id) {
046        this.id = id;
047    }
048
049    /**
050     * @return the lastname
051     */
052    public String getLastname() {
053        return lastname;
054    }
055
056    /**
057     * @param lastname the lastname to set
058     */
059    public void setLastname(String lastname) {
060        this.lastname = lastname;
061    }
062
063    /**
064     * @return the firstname
065     */
066    public String getFirstname() {
067        return firstname;
068    }
069
070    /**
071     * @param firstname the firstname to set
072     */
073    public void setFirstname(String firstname) {
074        this.firstname = firstname;
075    }
076
077    /**
078     * @return the fullname
079     */
080    public String getFullname() {
081        return fullname;
082    }
083
084    /**
085     * @param fullname the fullname to set
086     */
087    public void setFullname(String fullname) {
088        this.fullname = fullname;
089    }
090
091    /**
092     * @return the email
093     */
094    public String getEmail() {
095        return email;
096    }
097
098    /**
099     * @param email the email to set
100     */
101    public void setEmail(String email) {
102        this.email = email;
103    }
104
105    @Override
106    public int hashCode() {
107        return Objects.hash(id);
108    }
109
110    @Override
111    public boolean equals(Object obj) {
112        if (this == obj) {
113            return true;
114        }
115        if (obj == null) {
116            return false;
117        }
118        if (getClass() != obj.getClass()) {
119            return false;
120        }
121        MoodleUser other = (MoodleUser) obj;
122        return id == other.id;
123    }
124
125    @Override
126    public String toString() {
127        return "MoodleUser [id=" + id + ", fullname=" + fullname + "]";
128    }
129
130}