package com.sptg.ad.api.entity;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Date;
import java.util.List;

/**
 *            
 *                
 * description: 预警
 */
@Setter
@Getter
@NoArgsConstructor
public class EarlyWarning implements java.io.Serializable {

    @TableId(type = IdType.ID_WORKER)
    private Long id;

    /**
     * 设备序列号
     */
    private String serialNumber;

    /**
     * 设备Id
     */
    private Long deviceId;

    /**
     * 设备名称
     */
    private String deviceName;

    /**
     * 安装位置
     */
    private String installPath;

    /**
     * 预警类型：{ 1：月预警，2：周预警 }
     */
    private Integer type;

    /**
     * 任务类型：{ 1：人脸广告，2：闲时广告 }
     */
    private Integer taskType;

    /**
     * 预警值
     */
    private Long expect;

    /**
     * 实际值
     */
    private Long value;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 结束统计预警时间
     */
    private Date endTime;

    /**
     * 当前第几周
     */
    private Integer weekNum;

    /**
     * 结束标识：{ 0：未开始，1：已结束 }
     */
    private Integer endFlag;

    /* -------------------------------------------------------------------------------------------------------------- */


    @TableField(exist = false)
    private String time;

    /**
     * 月预警值
     */
    @TableField(exist = false)
    private Long monthExpect;

    /**
     * 周预警值
     */
    @TableField(exist = false)
    private Long weekExpect;

    @TableField(exist = false)
    private List<Long> deviceIdList;

    public EarlyWarning(DeviceAdvertStatistics statistics, Integer type, Integer taskType, Long expect, Date createTime, Date endTime) {
        this.serialNumber = statistics.getDeviceSerialNumber();
        this.deviceId = statistics.getDeviceId();
        this.deviceName = statistics.getDeviceName();
        this.installPath = statistics.getDeviceInstallPath();
        this.type = type;
        this.taskType = taskType;
        this.expect = expect;
        this.createTime = createTime;
        this.endTime = endTime;
        this.endFlag = 0;
        this.value = 0L;
    }
}
