package com.yimeng.okr.dto;

import com.yimeng.okr.entity.SysUser;
import com.yimeng.okr.enums.UserRole;
import lombok.Data;

@Data
public class UserInfo {
    private Long id;
    private String username;
    private String realName;
    private String email;
    private String position;
    private Long departmentId;
    private Long superiorId;
    private UserRole role;
    private String status;
    private java.time.LocalDateTime disabledAt;
    private java.time.LocalDateTime leftAt;

    public static UserInfo from(SysUser user) {
        UserInfo info = new UserInfo();
        info.setId(user.getId());
        info.setUsername(user.getUsername());
        info.setRealName(user.getRealName());
        info.setEmail(user.getEmail());
        info.setPosition(user.getPosition());
        info.setDepartmentId(user.getDepartmentId());
        info.setSuperiorId(user.getSuperiorId());
        info.setRole(user.getRole());
        info.setStatus(user.getStatus());
        info.setDisabledAt(user.getDisabledAt());
        info.setLeftAt(user.getLeftAt());
        return info;
    }
}
