package net.northking.cctp.common.dto;

import com.hzbank.testteam.autotest.dependencies.authDependency.enums.UserStatusEnum;
import com.hzbank.testteam.autotest.dependencies.monsterDependency.dto.UserDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

@ApiModel("用户信息")
@Data
public class UserOptions implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "用户ID", example = "14879753961997440")
    private String id;

    @ApiModelProperty(value = "用户名, 不能为空，必须由字母、数字、下划线、减号组成，且要在4-50位之间", example = "admin", required = true)
    private String userName;

    @ApiModelProperty(value = "姓名，不能为空，应在1-50位之间", example = "系统管理员", required = true)
    private String displayName;

    @ApiModelProperty(value = "用户状态，活跃（1）、删除（-1）", example = "1")
    private Integer status;

    public static UserOptions userDTOtoUserOptions(UserDTO userDTO){
        UserOptions options = new UserOptions();
        options.setId(userDTO.getId().toString());
        options.setUserName(userDTO.getUserName());
        options.setDisplayName(userDTO.getEmployeeName());
        if (userDTO.getDeleted() == 0) {
            options.setStatus(UserStatusEnum.ACTIVE.getValue());
        } else {
            options.setStatus(UserStatusEnum.DELETE.getValue());
        }
        return options;
    }
}
