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

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 电子学生证-电子围栏主信息 Entity
 *
 * @author zhanghaijun
 * @date 2021-08-04 15:07:58
 */
@Data
@TableName("edu_student_card_fence")
public class EduStudentCardFence {

    /**
     *
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     *
     */
    @TableField(value = "create_date", fill = FieldFill.INSERT)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createDate;

    /**
     *
     */
    @TableField(value = "create_id", fill = FieldFill.INSERT)
    private Long createId;

    /**
     *
     */
    @TableField(value = "update_date", fill = FieldFill.UPDATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateDate;

    /**
     *
     */
    @TableField(value = "update_id", fill = FieldFill.UPDATE)
    private Long updateId;

    /**
     *
     */
    @TableField("del_flag")
    @TableLogic(value = "0", delval = "1")
    private Integer delFlag;

    /**
     * 围栏名称
     */
    @TableField("name")
    private String name;

    /**
     * 围栏描述
     */
    @TableField("description")
    private String description;

    /**
     * 学校id
     */
    @TableField("school_id")
    private Long schoolId;

    /**
     * 围栏所属类型，0-学校，1-家长
     */
    @ApiModelProperty("围栏所属类型，0-学校，1-家长")
    @TableField("create_type")
    private Integer createType;

    /**
     * 围栏区域半径（单位：米）
     */
    @ApiModelProperty("围栏区域半径（单位：米）")
    @TableField("radius")
    private Integer radius;

    /**
     * 围栏圆心经度
     */
    @ApiModelProperty("围栏圆心经度")
    @TableField("lng")
    private Double lng;
    /**
     * 围栏圆心纬度
     */
    @ApiModelProperty("围栏圆心纬度")
    @TableField("lat")
    private Double lat;
    /**
     * 围栏告警类型，0-进出都有，1-进围栏，2-出围栏
     */
    @ApiModelProperty("围栏告警类型，0-进出都有，1-进围栏，2-出围栏")
    @TableField("alarm_type")
    private Integer alarmType;

    @ApiModelProperty("围栏中心地址")
    private String address;

    private transient Long studentId;

    public transient static final Map<Integer, String> PLAT_ALARM_TYPE = new HashMap<Integer, String>() {{
        put(0, "all");
        put(1, "in");
        put(2, "out");
    }};

    public transient static final Map<Integer, String> DEVICE_ALARM_TYPE = new HashMap<Integer, String>() {{
        put(0, "in,out");
        put(1, "in");
        put(2, "out");
    }};

    @TableField(exist = false)
    private String imei;
}