package com.kym.entity.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.kym.entity.BaseEntity;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;

/**
 * @author skyline
 * @description
 * @date 2023-09-05 00:01
 */
@Getter
@Setter
public class AdminUserVo extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 公司id
     */
    private Long companyId;

    /**
     * 用户名
     */
    private String username;

    /**
     * 密码 返回前端忽略
     */
//    @JsonIgnore
    private String password;

    /**
     * 昵称
     */
    private String nickname;

    /**
     * 手机号
     */
    private String mobilePhone;

    /**
     * 头像
     */
    private String avatar;

    /**
     * 0:禁用 1:启用
     */
    private Integer status;

    /**
     * 最后登录时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime lastLoginTime;

    private Long roleId;

    private String roleName;

    private List<String> permissions;


    public void setPermissions(String permissionsStr) {
        this.permissions = Arrays.asList(permissionsStr.split("\\|"));
    }
}
