package com.auth.dao.base.entity;

import com.auth.common.model.common.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;
import java.util.Date;

@Getter
@Setter
@Accessors(chain = true)
@TableName("sys_user")
@Schema(name = "User-用户信息实体类", title = "用户信息", description = "用户信息的实体类对象")
// 💡 根据自己需求看是否需要自定义用户信息
public class UserEntity extends BaseEntity /* implements UserDetails, CredentialsContainer */ {

    @Schema(name = "username", title = "用户名")
    private String username;

    @Schema(name = "nickname", title = "昵称")
    private String nickname;

    @Schema(name = "email", title = "邮箱")
    private String email;

    @Schema(name = "phone", title = "手机号")
    private String phone;

    @Schema(name = "password", title = "密码")
    private String password;

    @Schema(name = "avatar", title = "头像URL")
    private String avatar;

    @Schema(name = "status", title = "状态(0=禁用,1=正常,2=锁定)")
    private Integer status;

    @Schema(name = "salt", title = "密码盐值")
    private String salt;

    @Schema(name = "gender", title = "性别(0=未知,1=男,2=女)")
    private Integer gender;

    @Schema(name = "birthday", title = "出生日期")
    private Date birthday;

    @Schema(name = "introduction", title = "个人简介")
    private String introduction;

    @Schema(name = "lastLoginIp", title = "最后登录IP")
    private String lastLoginIp;

    @Schema(name = "lastLoginRegion", title = "最后登录地区")
    private String lastLoginRegion;

    @Schema(name = "lastLoginTime", title = "最后登录时间")
    private LocalDateTime lastLoginTime;

    @Schema(name = "deptId", title = "所属部门ID")
    private Long deptId;

    @Schema(name = "postId", title = "所属岗位ID")
    private Long postId;

    @Schema(name = "isDeleted", title = "是否删除")
    private Boolean isDeleted;

    // @TableField(exist = false)
    // private Set<? extends GrantedAuthority> authorities;
    //
    // @Override
    // public void eraseCredentials() {
    //     this.password = null;
    // }
    //
    // @Override
    // public Set<? extends GrantedAuthority> getAuthorities() {
    //     return this.authorities;
    // }

}
