package cn.estsh.i3plus.pojo.model.platform;

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.platform.bean.SysUser;
import cn.estsh.i3plus.pojo.platform.bean.SysUserInfo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
 * @Description :
 * @Reference :
 * @Author : Adair Peng
 * @CreateDate : 2018-12-22 17:29
 * @Modify:
 **/
@Data
public class UserDetailModel extends BaseBean {


    private static final long serialVersionUID = 4413526491980249893L;
    @ApiParam(value ="账号ID")
    private String userId;

    @ApiParam(value ="用户ID")
    private String userInfoId;

    @ApiParam(value ="用户语言")
    private String userLanguageCode;

    @ApiParam(value ="登陆名称" , access ="登陆名称")
    private String userLoginName;

    @ApiParam(value ="登陆密码")
    private String userLoginPassword;

    @ApiParam(value ="邮箱" , access ="邮箱")
    private String userEmail;

    @ApiParam(value ="手机号" , access ="手机号")
    private String userPhone;

    @ApiParam(value ="账号状态(枚举：1正常,2冻结使用,3账号异常,4离职，5服务到期)" , example ="-1")
    private Integer userStatus;

    @ApiParam(value ="组织ID 集合")
    private List<String> userOrganizeIdList;

    @ApiParam(value ="部门ID")
    private String userDepartmentId;

    @ApiParam(value ="部门ID 集合")
    private List<String> userDepartmentIdList;

    @ApiParam(value ="角色ID 集合")
    private List<String> userRoleIdList;

    @ApiParam(value ="姓名" , access ="名称")
    private String infoName;

    @ApiParam(value ="工号")
    private String infoEmpNo;

    @ApiParam(value ="员工类型", access ="实习、试用期、正式")
    private Integer infoEmployeeType;

    @ApiParam(value ="员工等级")
    private Integer infoGrade;

    @ApiParam(value ="入职日期" , access ="默认当前时间")
    private String infoJoinDate;

    @ApiParam(value ="离职日期" , access ="默认当前时间")
    private String infoResignationDate;

    @ApiParam(value ="证件类型")
    private Integer infoCardType;

    @ApiParam(value ="证件编号")
    private String infoCardNumber;

    @ApiParam(value ="毕业院校")
    private String infoSchool;

    @ApiParam(value ="毕业专业")
    private String infoSchoolProfession;

    @ApiParam(value ="毕业时间")
    private String infoSchoolLeaveDate;

    @ApiParam(value ="学历")
    private Integer infoSchoolEducation;

    @ApiParam(value ="性别（1.男，2.女）" , example ="1" , access ="性别（1.男，2.女）")
    private Integer infoSex;

    @ApiParam(value ="籍贯")
    private String infoBirthplace;

    @ApiParam(value ="种族")
    private Integer infoRace;

    @ApiParam(value ="婚姻" , example ="1" , access ="性别（1.未知，2.已婚,3未婚）")
    private Integer infoMarriage;

    @ApiParam(value ="紧急联系人")
    private String infoEmergencyContact;

    @ApiParam(value ="紧急联系人-电话")
    private String infoEmergencyPhone;

    @ApiParam(value ="家庭地址")
    private String infoFamilyAddress;

    @ApiParam(value ="出生日期")
    private String infoBornDate;

    @ApiParam(value ="政治面貌")
    private Integer infoPoliticalStatus;

    @ApiParam(value ="兴趣爱好")
    private String infoHobby;

    @ApiParam(value ="用户状态" , example ="-1")
    private Integer infoStatus;

    @ApiParam(value ="用户图像" , example = "-1")
    @JsonSerialize(using = ToStringSerializer.class)
    private String infoImageId;

    @ApiParam(value ="部门ID" , example ="-1")
    @JsonSerialize(using = ToStringSerializer.class)
    private String infoDepartmentId;

    @ApiParam(value ="岗位ID" , example ="-1")
    @JsonSerialize(using = ToStringSerializer.class)
    private String infoPositionId;

    @ApiParam(value ="组织ID" , example = "0")
    @JsonSerialize(using = ToStringSerializer.class)
    private String infoOrganizeId;

    @ApiParam(value ="用户所有部门信息")
    private List<String> infoDepartmentIdList;

    @ApiParam(value ="用户所有岗位信息")
    private List<String> infoPositionIdList;

    @ApiParam(value ="用户所有组织信息")
    private List<String> infoOrganizeIdList;

    @ApiParam(value ="账号ID集合信息")
    private List<String> userIdList;

    @ApiParam(value ="用户ID集合信息")
    private List<String> userInfoIdList;

    public SysUser getSysUser(){
        SysUser user = new SysUser();
        user.setId(!StringUtils.isBlank(this.userId) ? Long.parseLong(this.userId) : null);
        user.setUserInfoId(!StringUtils.isBlank(this.userInfoId) ? Long.parseLong(this.userInfoId) : null);
        user.setUserLoginName(this.userLoginName);
        user.setUserEmpNo(this.infoEmpNo);
        user.setUserName(this.infoName);
        user.setUserEmail(this.userEmail);
        user.setUserPhone(this.userPhone);
        user.setUserLoginPassword(this.userLoginPassword);
        user.setLanguageCode(this.userLanguageCode);
        user.setOrganizeCode(this.organizeCode);

        return user;
    }

    public SysUserInfo getSysUserInfo(){
        SysUserInfo info = new SysUserInfo();

        info.setId(!StringUtils.isAnyBlank(this.userInfoId)? Long.parseLong(this.userInfoId) : null);
        info.setUserId(!StringUtils.isAnyBlank(this.userId)? Long.parseLong(this.userId) : null);
        info.setUserImageId(!StringUtils.isAnyBlank(this.infoImageId)? Long.parseLong(this.infoImageId) : null);
        info.setPositionId(!StringUtils.isAnyBlank(this.infoPositionId)? Long.parseLong(this.infoPositionId) : null);
        info.setName(this.infoName);
        info.setUserEmpNo(this.infoEmpNo);
        info.setUserJoinDate(this.infoJoinDate);
        info.setUserResignationDate(this.infoResignationDate);
        info.setUserCardType(this.infoCardType);
        info.setUserCardNumber(this.infoCardNumber);
        info.setUserSchool(this.infoSchool);
        info.setUserSchoolProfession(this.infoSchoolProfession);
        info.setUserSchoolLeaveDate(this.infoSchoolLeaveDate);
        info.setUserSchoolEducation(this.infoSchoolEducation);
        info.setUserSex(this.infoSex);
        info.setUserBirthplace(this.infoBirthplace);
        info.setUserRace(this.infoRace);
        info.setUserMarriage(this.infoMarriage);
        info.setUserEmergencyContact(this.infoEmergencyContact);
        info.setUserEmergencyPhone(this.infoEmergencyPhone);
        info.setUserFamilyAddress(this.infoFamilyAddress);
        info.setUserBornDate(this.infoBornDate);
        info.setUserHobby(this.infoHobby);
        info.setUserPoliticalStatus(this.infoPoliticalStatus);
        info.setUserGrade(this.infoGrade);
        info.setUserEmployeeType(this.infoEmployeeType);
        info.setOrganizeCode(this.organizeCode);

        return info;
    }

}
