package com.huimv.employment.dao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;

import java.time.LocalDateTime;

/**
 * 小程序用户主表 {@code fe_user}。
 * <p>
 * 企业主（enterprise）与临时工（worker）共用，通过 {@link #userType} 区分。
 * 一期登录方式：短信验证码、微信 code2session、可选账密（登录后设置）。
 * </p>
 */
@TableName("fe_user")
public class FeUser {

    @TableId(type = IdType.AUTO)
    private Long id;

    /** 微信 openid，仅微信登录用户有值；纯短信登录可为空 */
    private String openid;

    private String unionid;

    /** enterprise / worker */
    private String userType;

    private String nickname;

    private String avatarUrl;

    private String mobileEnc;

    private String mobileMask;

    /** 登录用户名，设密时写入，全局唯一 */
    private String username;

    /** BCrypt 密码哈希，NULL 表示未设密 */
    private String passwordHash;

    private Integer pwdFailedCount;

    private LocalDateTime pwdLockedUntil;

    private LocalDateTime passwordSetAt;

    private String sessionKey;

    /** active / disabled */
    private String status;

    private LocalDateTime lastLoginAt;

    private LocalDateTime createTime;

    private LocalDateTime updateTime;

    @TableLogic
    private Integer delFlag;

    public Long getId() {
        return id;
    }

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

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public String getUnionid() {
        return unionid;
    }

    public void setUnionid(String unionid) {
        this.unionid = unionid;
    }

    public String getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType = userType;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getAvatarUrl() {
        return avatarUrl;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }

    public String getMobileEnc() {
        return mobileEnc;
    }

    public void setMobileEnc(String mobileEnc) {
        this.mobileEnc = mobileEnc;
    }

    public String getMobileMask() {
        return mobileMask;
    }

    public void setMobileMask(String mobileMask) {
        this.mobileMask = mobileMask;
    }

    public String getUsername() {
        return username;
    }

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

    public String getPasswordHash() {
        return passwordHash;
    }

    public void setPasswordHash(String passwordHash) {
        this.passwordHash = passwordHash;
    }

    public Integer getPwdFailedCount() {
        return pwdFailedCount;
    }

    public void setPwdFailedCount(Integer pwdFailedCount) {
        this.pwdFailedCount = pwdFailedCount;
    }

    public LocalDateTime getPwdLockedUntil() {
        return pwdLockedUntil;
    }

    public void setPwdLockedUntil(LocalDateTime pwdLockedUntil) {
        this.pwdLockedUntil = pwdLockedUntil;
    }

    public LocalDateTime getPasswordSetAt() {
        return passwordSetAt;
    }

    public void setPasswordSetAt(LocalDateTime passwordSetAt) {
        this.passwordSetAt = passwordSetAt;
    }

    public String getSessionKey() {
        return sessionKey;
    }

    public void setSessionKey(String sessionKey) {
        this.sessionKey = sessionKey;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public LocalDateTime getLastLoginAt() {
        return lastLoginAt;
    }

    public void setLastLoginAt(LocalDateTime lastLoginAt) {
        this.lastLoginAt = lastLoginAt;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(Integer delFlag) {
        this.delFlag = delFlag;
    }
}
