package hozza.network.models.auth.entities;

import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

@Data
@Entity(name="users")
@Table(name="users")
public class User implements Serializable
{
    @Id
    @Column(name = "username",unique = true)
    private String username;

    @Column(name = "password")
    private String password;

    @Column(name = "enabled")
    private boolean enabled;

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "authority", cascade = CascadeType.ALL)
    private List<Authority> roles;

    public User(String username, String password, boolean enabled) {
        this.username = username;
        this.password = password;
        this.enabled = enabled;
    }

    protected User() {

    }

    protected boolean canEqual(final Object other) {
        return other instanceof User;
    }

}
