package com.jpsoft.shinestar.modules.base.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 描述:base_person_info的实体类
 */
@Data
@ApiModel(value = "base_person_info的实体类")
public class PersonInfo implements Serializable {
    /**
     * 编号
     */
    @ApiModelProperty(value = "编号")
    private Long id;
    /**
     * 企业编号
     */
    @ApiModelProperty(value = "企业编号")
    private String companyId;
    /**
     * 企业名称
     */
    @ApiModelProperty(value = "企业名称")
    private String companyName;
    /**
     * 姓名
     */
    @ApiModelProperty(value = "姓名")
    private String name;
    /**
     * 手机号
     */
    @ApiModelProperty(value = "手机号")
    private String phone;
    /**
     * 身份证号
     */
    @ApiModelProperty(value = "身份证号")
    private String idCard;
    /**
     * 微信openId
     */
    @ApiModelProperty(value = "微信openId")
    private String openId;
    /**
     * 人脸
     */
    @ApiModelProperty(value = "人脸")
    private Boolean faceEnabled;

    @ApiModelProperty(value = "是否已将人脸信息传给终端")
    private Boolean faceBound;

    /**
     * 刷卡
     */
    @ApiModelProperty(value = "刷卡")
    private Boolean cardEnabled;
    /**
     * 手机
     */
    @ApiModelProperty(value = "手机")
    private Boolean appEnabled;
    /**
     * 密码
     */
    @ApiModelProperty(value = "密码")
    private Boolean passwordEnabled;
    /**
     * 访客
     */
    @ApiModelProperty(value = "访客")
    private Boolean guestEnabled = false;
    /**
     * 位置1
     */
    @ApiModelProperty(value = "位置1")
    private String position1;
    /**
     * 位置2
     */
    @ApiModelProperty(value = "位置2")
    private String position2;
    /**
     * 位置3
     */
    @ApiModelProperty(value = "位置3")
    private String position3;
    /**
     * 位置4
     */
    @ApiModelProperty(value = "位置4")
    private String position4;
    /**
     * 位置5
     */
    @ApiModelProperty(value = "位置5")
    private String position5;
    /**
     * 是否删除
     */
    @ApiModelProperty(value = "是否删除")
    private Boolean delFlag;
    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人")
    private String createBy;
    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    /**
     * 更新人
     */
    @ApiModelProperty(value = "更新人")
    private String updateBy;
    /**
     * 更新时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    @ApiModelProperty(value = "人脸相片地址")
    private String faceImageUrl;

    @ApiModelProperty(value="权限")
    private String popedom;
    @ApiModelProperty(value="权限翻译")
    private String popedomName;

    private BigDecimal lastTemperatureLog;

    private Boolean isNormal;

    @ApiModelProperty(value="关联单位")
    private String personCompany;

    @ApiModelProperty(value="是否接收微信通知")
    private Boolean wechatNoticeEnabled;

    public Boolean getWechatNoticeEnabled() {
        if(wechatNoticeEnabled==null){
            return false;
        }
        else{
            return wechatNoticeEnabled;
        }
    }

    @ApiModelProperty(value="是否允许查看本单位数据")
    private Boolean allowViewLocal;

    public Boolean getAllowViewLocal() {
        if(allowViewLocal==null){
            return false;
        }
        else{
            return allowViewLocal;
        }
    }

    @ApiModelProperty(value="单位性质")
    private String companyType;

    @ApiModelProperty(value="健康照路径")
    private String healthErtificateUrl;

    @ApiModelProperty(value="是否同步")
    private Boolean isSync;

    @ApiModelProperty(value = "性别")
    private String sex;

    @ApiModelProperty(value = "园区ID")
    private String parkId;

    @ApiModelProperty(value = "园区")
    private String parkName;

    /**
     * 00绿码 01黄码 10红码 11灰码
     */
    private String healthyCode;

    private Date updateHealthyTime;

    @ApiModelProperty(value = "健康码原因")
    private String healthyReason;

    @ApiModelProperty(value = "所在部门")
    private String companyStructName;

    @ApiModelProperty(value = "所在单位角色")
    private String roleName;

    @ApiModelProperty(value = "所在单位角色编号")
    private String personRoleId;

    @ApiModelProperty(value="工作状态:1-工作，2-外出，3-出差，4-休假，7-休假")
    private String workStatus;

    public String getWorkStatusN(){
        String text = "";

        if(WorkStatus.WORK.equals(workStatus)){
            text = "工作";
        }
        else if(WorkStatus.OUT.equals(workStatus)){
            text = "外出";
        }
        else if(WorkStatus.TRAVEL.equals(workStatus)){
            text = "出差";
        }
        else if(WorkStatus.VOCATION.equals(workStatus)){
            text = "休假";
        }else if (WorkStatus.YEAR.equals(workStatus)){
            text = "年假";
        }
        return text;
    }



    @ApiModelProperty(value = "租户ID，显示用不写入数据库")
    private String checkinInfoId;

    private String jobNumber;

    @ApiModelProperty(value = "编号")
    private String strId;

    @ApiModelProperty(value = "车牌号")
    private String carNum;

    @ApiModelProperty(value = "后勤人员类别")
    private String hqStatus;

    @ApiModelProperty(value = "后勤排序号")
    private Integer hqSortNo;
}