package com.cristobalbernal.foro.Entidades;

import jakarta.persistence.*;

@Entity
@Table(name = "users", schema = "forogruas", catalog = "")
public class UsersEntity {
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Id
    @Column(name = "id", nullable = false)
    private int id;
    @Basic
    @Column(name = "name", nullable = true, length = 45)
    private String name;
    @Basic
    @Column(name = "firstname", nullable = true, length = 45)
    private String firstname;
    @Basic
    @Column(name = "secondname", nullable = true, length = 45)
    private String secondname;
    @Basic
    @Column(name = "password", nullable = true, length = 45)
    private String password;
    @Basic
    @Column(name = "email", nullable = true, length = 45)
    private String email;
    @Basic
    @Column(name = "username", nullable = true, length = 45)
    private String username;
    @Basic
    @Column(name = "Imgen", nullable = true, length = 150)
    private String imgen;
    @Basic
    @Column(name = "tipoPrivilegios", nullable = true)
    private Byte tipoPrivilegios;

    public UsersEntity() {

    }

    public int getId() {
        return id;
    }

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

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getFirstname() {
        return firstname;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public String getSecondname() {
        return secondname;
    }

    public void setSecondname(String secondname) {
        this.secondname = secondname;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getImgen() {
        return imgen;
    }

    public void setImgen(String imgen) {
        this.imgen = imgen;
    }

    public Byte getTipoPrivilegios() {
        return tipoPrivilegios;
    }

    public void setTipoPrivilegios(Byte tipoPrivilegios) {
        this.tipoPrivilegios = tipoPrivilegios;
    }

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

        UsersEntity that = (UsersEntity) o;

        if (id != that.id) return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;
        if (firstname != null ? !firstname.equals(that.firstname) : that.firstname != null) return false;
        if (secondname != null ? !secondname.equals(that.secondname) : that.secondname != null) return false;
        if (password != null ? !password.equals(that.password) : that.password != null) return false;
        if (email != null ? !email.equals(that.email) : that.email != null) return false;
        if (username != null ? !username.equals(that.username) : that.username != null) return false;
        if (imgen != null ? !imgen.equals(that.imgen) : that.imgen != null) return false;
        if (tipoPrivilegios != null ? !tipoPrivilegios.equals(that.tipoPrivilegios) : that.tipoPrivilegios != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (firstname != null ? firstname.hashCode() : 0);
        result = 31 * result + (secondname != null ? secondname.hashCode() : 0);
        result = 31 * result + (password != null ? password.hashCode() : 0);
        result = 31 * result + (email != null ? email.hashCode() : 0);
        result = 31 * result + (username != null ? username.hashCode() : 0);
        result = 31 * result + (imgen != null ? imgen.hashCode() : 0);
        result = 31 * result + (tipoPrivilegios != null ? tipoPrivilegios.hashCode() : 0);
        return result;
    }

    public UsersEntity(String name, String firstname, String secondname, String password, String email, String username, String imgen, Byte tipoPrivilegios) {
        this.name = name;
        this.firstname = firstname;
        this.secondname = secondname;
        this.password = password;
        this.email = email;
        this.username = username;
        this.imgen = imgen;
        this.tipoPrivilegios = tipoPrivilegios;
    }
}
