package xyz.luxnk.lproject.bean;

import org.nutz.dao.entity.annotation.*;

import java.util.Date;
import java.util.List;

/**
 * 用户基本信息Pojo
 * 对应user_info表
 */
@Table("user_info")
public class UserInfo extends BasePojo {

    @Name
    @Prev(els = @EL("snowflake()"))
    private String id;

    @Column
    private String username;

    @Column
    private String password;

    @Column
    private String salt;

    @Column
    private boolean locked;

    @ManyMany(from = "u_id", relation = "relation_user_role", target = Role.class, to = "role_id")
    private List<Role> roles;

    @ManyMany(from = "u_id", relation = "relation_user_permission", target = Permission.class, to = "permission_id")
    private List<Permission> permissions;

    @One(target = UserProfile.class, field = "id", key = "userId")
    private UserProfile profile;

    public String getId() {
        return id;
    }

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

    public String getUsername() {
        return username;
    }

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

    public String getPassword() {
        return password;
    }

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

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public boolean isLocked() {
        return locked;
    }

    public void setLocked(boolean locked) {
        this.locked = locked;
    }

    public List<Role> getRoles() {
        return roles;
    }

    public void setRoles(List<Role> roles) {
        this.roles = roles;
    }

    public List<Permission> getPermissions() {
        return permissions;
    }

    public void setPermissions(List<Permission> permissions) {
        this.permissions = permissions;
    }

    public UserProfile getProfile() {
        return profile;
    }

    public void setProfile(UserProfile profile) {
        this.profile = profile;
    }
}
