package com.yida.data.common.core.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yida.data.common.core.entity.system.EduUserLogo;
import java.time.LocalDateTime;
import java.util.Collection;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

/**
 * @author MrBird
 */
@Data
@SuppressWarnings("all")
@EqualsAndHashCode(callSuper = true)
public class FebsAuthUser extends User {

    private static final long serialVersionUID = -6411066541689297219L;

    private String nickname;

    private Long userId;

    private String avatar;

    private String email;

    private String mobile;

    private String sex;

    private Long deptId;

    private Integer deptType;

    private String deptName;

    private String roleId;

    private String roleName;

    /**
     * 角色标识
     */
    private String rolePerms;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime lastLoginTime;

    private String description;

    private String status;

    private Integer schoolNature;

    private String deptIds;

    private Long identityId;

    private String openId;

    /**
     * 代理商id(角色为代理商相关时存在)
     */
    private Long agentId;

    /**
     * 创建人id
     */
    private Long createId;

    /**
     * 创建人部门id
     */
    private Long createDeptId;

    /**
     * 主部门id(学校或教育局部门id)
     */
    private Long mainDeptId;

    /**
     * 主角色标识
     */
    private String mainRolePerms;

    private EduUserLogo userLogo;

    public FebsAuthUser(String username, String password, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, authorities);
    }

    public FebsAuthUser(String username, String password, boolean enabled, boolean accountNonExpired,
        boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
    }
}
