package com.gic.haoban.manage.api.dto;

import com.gic.commons.util.DateUtil;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

public class StaffDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 员工id
     */
    private String staffId;
    /**
     * 企业微信id
     */
    private String wxEnterpriseId;
    /**
     * 微信用户id
     */
    private String wxUserId;
    /**
     * 手机号
     */
    private String phoneNumber;
    /**
     * 员工姓名
     */
    private String staffName;
    /**
     * 国家码
     */
    private String nationCode;
    /**
     * 昵称
     */
    private String nickName;
    /**
     * 性别
     */
    private Integer sex;
    /**
     * 职位
     */
    private String postion;
    /**
     * 激活状态
     */
    private Integer activeFlag;
    /**
     * 对外职务
     */
    private String extendPostion;
    /**
     * 状态
     */
    private Integer statusFlag;

    private Date createTime;

    private Date updateTime;

    private String departmentIds;

    private String headImg;

    private Integer sort;

    private List<DepartmentDTO> departmentList;

    private int bindFlag;

    private String clerkCode;

    private String staffDepartmentRelatedId;

    private int clerkType;

    private Integer syncPostionFlag;

    private Integer superManagerFlag;

    private Boolean weixinPush;

    private Integer memberCount;

    private String clerkId;
    /**
     * 关联状态 1 已关联 0 未关联
     * 关联状态为 员工是否关联某门店导购
     */
    private Integer relationFlag;

    private String wxOpenUseId;

    private String wxOpenId;
    private String qrCode;
    private String clerkName;
    private String defaultGicEid;
    private Integer addNum;
    private String enterpriseId;
    private String storeId;
    private int openConcatFlag = 0;

    private String ownerRemark;

    /**
     * 许可激活时间
     */
    private Date activeTime;
    /**
     * 许可过期时间
     */
    private Date expireTime;
    /**
     * 许可状态  0 未激活，1 正常有效，2 即将过期，3 已过期
     */
    private Integer permitState;
    /**
     * 是否授权  0否1是
     */
    private Integer authorizedFlag;
    /**
     * 企微激活码
     */
    private String activeCode;
    /**
     * gic品牌名称
     */
    private List<String> enterpriseNameList;

    public List<String> getEnterpriseNameList() {
        return enterpriseNameList;
    }

    public void setEnterpriseNameList(List<String> enterpriseNameList) {
        this.enterpriseNameList = enterpriseNameList;
    }

    public String getActiveCode() {
        return activeCode;
    }

    public void setActiveCode(String activeCode) {
        this.activeCode = activeCode;
    }

    public Integer getAuthorizedFlag() {
        // 如果员工有qr_code,则代表已经授权
        if (null != this.qrCode)
            this.authorizedFlag = 1;
        else
            this.authorizedFlag = 0;
        return authorizedFlag;
    }

    public void setAuthorizedFlag(Integer authorizedFlag) {
        this.authorizedFlag = authorizedFlag;
    }

    public Date getActiveTime() {
        return activeTime;
    }

    public void setActiveTime(Date activeTime) {
        this.activeTime = activeTime;
    }

    public Date getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(Date expireTime) {
        this.expireTime = expireTime;
    }

    public Integer getPermitState() {
        /**
         * 根据当前时间判断许可状态  0 未激活，1 正常有效，2 即将过期，3 已过期
         * 正常有效：过期时间>30天
         * 即将过期：未过期且过期时间<=30天
         * 已过期：当前许可已到过期时间
         */
        Date now = new Date();
        if (null == this.expireTime) {
            this.permitState = 0;
        } else if (now.after(this.expireTime)) {
            this.permitState = 3;
        } else if (now.before(this.expireTime)) {
            Date date = DateUtil.addDay(now, 30);
            if (date.after(this.expireTime)) {
                this.permitState = 2;
            } else {
                this.permitState = 1;
            }
        }
        return permitState;
    }

    public void setPermitState(Integer permitState) {
        this.permitState = permitState;
    }

    public String getOwnerRemark() {
        return ownerRemark;
    }

    public void setOwnerRemark(String ownerRemark) {
        this.ownerRemark = ownerRemark;
    }

    public int getOpenConcatFlag() {
        return openConcatFlag;
    }

    public void setOpenConcatFlag(int openConcatFlag) {
        this.openConcatFlag = openConcatFlag;
    }

    public String getDefaultGicEid() {
        return defaultGicEid;
    }

    public void setDefaultGicEid(String defaultGicEid) {
        this.defaultGicEid = defaultGicEid;
    }

    public String getClerkId() {
        return clerkId;
    }

    public void setClerkId(String clerkId) {
        this.clerkId = clerkId;
    }

    public int getClerkType() {
        return clerkType;
    }

    public void setClerkType(int clerkType) {
        this.clerkType = clerkType;
    }

    public String getStaffDepartmentRelatedId() {
        return staffDepartmentRelatedId;
    }

    public void setStaffDepartmentRelatedId(String staffDepartmentRelatedId) {
        this.staffDepartmentRelatedId = staffDepartmentRelatedId;
    }

    public String getClerkCode() {
        return clerkCode;
    }

    public void setClerkCode(String clerkCode) {
        this.clerkCode = clerkCode;
    }


    public int getBindFlag() {
        return bindFlag;
    }

    public void setBindFlag(int bindFlag) {
        this.bindFlag = bindFlag;
    }

    public String getStaffId() {
        return staffId;
    }

    public void setStaffId(String staffId) {
        this.staffId = staffId == null ? null : staffId.trim();
    }


    public String getWxEnterpriseId() {
        return wxEnterpriseId;
    }

    public void setWxEnterpriseId(String wxEnterpriseId) {
        this.wxEnterpriseId = wxEnterpriseId;
    }

    public String getExtendPostion() {
        return extendPostion;
    }

    public void setExtendPostion(String extendPostion) {
        this.extendPostion = extendPostion;
    }

    public Integer getStatusFlag() {
        return statusFlag;
    }

    public void setStatusFlag(Integer statusFlag) {
        this.statusFlag = statusFlag;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getWxUserId() {
        return wxUserId;
    }

    public void setWxUserId(String wxUserId) {
        this.wxUserId = wxUserId == null ? null : wxUserId.trim();
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber == null ? null : phoneNumber.trim();
    }

    public String getStaffName() {
        return staffName;
    }

    public void setStaffName(String staffName) {
        this.staffName = staffName == null ? null : staffName.trim();
    }

    public String getNationCode() {
        return nationCode;
    }

    public void setNationCode(String nationCode) {
        this.nationCode = nationCode == null ? null : nationCode.trim();
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName == null ? null : nickName.trim();
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public String getPostion() {
        return postion;
    }

    public void setPostion(String postion) {
        this.postion = postion == null ? null : postion.trim();
    }

    public Integer getActiveFlag() {
        return activeFlag;
    }

    public void setActiveFlag(Integer activeFlag) {
        this.activeFlag = activeFlag;
    }

    public String getDepartmentIds() {
        return departmentIds;
    }

    public void setDepartmentIds(String departmentIds) {
        this.departmentIds = departmentIds;
    }

    public String getHeadImg() {
        return headImg;
    }

    public void setHeadImg(String headImg) {
        this.headImg = headImg;
    }

    public List<DepartmentDTO> getDepartmentList() {
        return departmentList;
    }

    public void setDepartmentList(List<DepartmentDTO> departmentList) {
        this.departmentList = departmentList;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Integer getSyncPostionFlag() {
        return syncPostionFlag;
    }

    public void setSyncPostionFlag(Integer syncPostionFlag) {
        this.syncPostionFlag = syncPostionFlag;
    }

    public Integer getSuperManagerFlag() {
        return superManagerFlag;
    }

    public void setSuperManagerFlag(Integer superManagerFlag) {
        this.superManagerFlag = superManagerFlag;
    }

    public Boolean getWeixinPush() {
        return weixinPush;
    }

    public void setWeixinPush(Boolean weixinPush) {
        this.weixinPush = weixinPush;
    }

    public Integer getMemberCount() {
        return memberCount;
    }

    public void setMemberCount(Integer memberCount) {
        this.memberCount = memberCount;
    }

    public Integer getRelationFlag() {
        return relationFlag;
    }

    public void setRelationFlag(Integer relationFlag) {
        this.relationFlag = relationFlag;
    }

    public String getWxOpenUseId() {
        return wxOpenUseId;
    }

    public void setWxOpenUseId(String wxOpenUseId) {
        this.wxOpenUseId = wxOpenUseId;
    }

    public String getWxOpenId() {
        return wxOpenId;
    }

    public void setWxOpenId(String wxOpenId) {
        this.wxOpenId = wxOpenId;
    }

    public String getQrCode() {
        return qrCode;
    }

    public void setQrCode(String qrCode) {
        this.qrCode = qrCode;
    }

    public String getClerkName() {
        return clerkName;
    }

    public void setClerkName(String clerkName) {
        this.clerkName = clerkName;
    }

    public Integer getAddNum() {
        return addNum;
    }

    public void setAddNum(Integer addNum) {
        this.addNum = addNum;
    }

    public String getEnterpriseId() {
        return enterpriseId;
    }

    public void setEnterpriseId(String enterpriseId) {
        this.enterpriseId = enterpriseId;
    }

    public String getStoreId() {
        return storeId;
    }

    public void setStoreId(String storeId) {
        this.storeId = storeId;
    }
}
