package cn.novalon.manage.sys.core.domain;

import cn.novalon.manage.common.util.SnowflakeId;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;

/**
 * 用户领域对象
 * 
 * @author 张翔
 * @date 2026-03-13
 */
@Schema(description = "系统用户实体")
public class SysUser extends BaseDomain {

    @Schema(description = "用户名", example = "admin")
    private String username;

    @Schema(description = "密码（加密后）", example = "$2a$10$...")
    private String password;

    @Schema(description = "昵称", example = "管理员")
    private String nickname;

    @Schema(description = "邮箱", example = "admin@example.com")
    private String email;

    @Schema(description = "手机号", example = "13800138000")
    private String phone;

    @Schema(description = "头像", example = "https://example.com/avatar.jpg")
    private String avatar;

    @Schema(description = "角色ID", example = "1")
    private Long roleId;

    @Schema(description = "状态：0-禁用，1-正常", example = "1")
    private Integer status;

    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 getNickname() {
        return nickname;
    }

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

    public String getEmail() {
        return email;
    }

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

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public Integer getStatus() {
        return status;
    }

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

    /**
     * 生成主键ID
     * 
     * @return 主键ID
     */
    public Long generateId() {
        this.id = SnowflakeId.nextId();
        return this.id;
    }

    /**
     * 删除用户
     */
    public void delete() {
        this.deletedAt = LocalDateTime.now();
    }
}
