package jnpf.model.personnels.vo.authoritys;

import jnpf.model.personnels.po.FtbPersonnelsPermissions;
import lombok.Data;

import java.util.List;

@Data
public class FtbPersonnelsPermissionUserVO {
    /**
     * 员工权限主键id(编辑时需要)
     */
    private String id;
    /**
     * 用户id
     */
    private String userId;

    /**
     * 用户姓名
     */
    private String userName;

    /**
     * 手机号码
     */
    private String phone;

    /**
     * 员工id(页面显示用)
     */
    private String userCustomId;

    /**
     * 权限适用范围,0所在组织和下级组织员工,1所在组织员工,2仅下属，3指定组织
     */
    private Integer scopePermission;

    /**
     * 指定组织id集合
     */
    private String specifyOrgIds;

    /**
     * 员工所绑定的组织信息
     */
    private List<EmployeeOrganizationInformationVO> employeeOrganizationInformationVOS;

    /**
     * 权限信息
     */
    private List<FtbPersonnelsPermissionVO> ftbPersonnelsPermissionVOS;

    @Data
    public static class EmployeeOrganizationInformationVO {
        /**
         * 组织名称
         */
        private String orgName;

        /**
         * 岗位名称
         */
        private String postName;

        /**
         * 职等名称
         */
        private String postRankName;

        /**
         * 直属主管名称
         */
        private String nameOfImmediateSupervisor;
    }

    public static FtbPersonnelsPermissionUserVO convertFtbPersonnelsPermissionUserVO(FtbPersonnelsPermissions ftbPersonnelsPermissions) {
        if (ftbPersonnelsPermissions == null) {
            return null;
        }
        FtbPersonnelsPermissionUserVO ftbPersonnelsPermissionUserVO = new FtbPersonnelsPermissionUserVO();
        ftbPersonnelsPermissionUserVO.setUserName(ftbPersonnelsPermissions.getUserName());
        ftbPersonnelsPermissionUserVO.setPhone(ftbPersonnelsPermissions.getPhone());
        ftbPersonnelsPermissionUserVO.setUserCustomId(ftbPersonnelsPermissions.getUserCustomId());
        ftbPersonnelsPermissionUserVO.setScopePermission(ftbPersonnelsPermissions.getScopePermission());
        ftbPersonnelsPermissionUserVO.setId(ftbPersonnelsPermissions.getId());
        ftbPersonnelsPermissionUserVO.setUserId(ftbPersonnelsPermissions.getUserId());
        ftbPersonnelsPermissionUserVO.setSpecifyOrgIds(ftbPersonnelsPermissions.getSpecifyOrgIds());
        return ftbPersonnelsPermissionUserVO;
    }

}
