package org.lingniu.sdk.model.user;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.oauth2.core.user.OAuth2User;

import java.io.Serial;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
@NoArgsConstructor
public class UserInfo implements OAuth2User, Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    /**
     * userid
     */
    private Long userId;
    /**
     * 用户账号
     */
    private String username;
    /**
     * 用户名
     */
    private String nickName;
    /**
     * 性别
     */
    private String sex;
    /**
     * 当前部门
     */
    private Long currentDeptId;
    /**
     * 用户部门列表
     */
    private List<UserDept> userDepts;
    /**
     * 用户岗位列表
     */
    private List<UserPost> userPosts;
    /**
     * 用户数据权限
     */
    private DataPermission dataPermission;
    /**
     * 权限列表
     */
    private Set<String> permissions;
    /**
     * 角色列表
     */
    private Set<String> roles;


    @Override
    public String getName() {
        return username;
    }

    @Override
    public Map<String, Object> getAttributes() {
        return Map.of();
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return List.of();
    }
}
