package com.yuchen.saas.device.api.entity.scene;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
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.util.Date;

/**
 * @Author: 宋少挺
 * @CreateTime: 2022/10/19 15:24
 * @Description: 场景联动规则执行日志
 * @Version: 1.0
 */
@Data
@ApiModel(value = "场景联动规则执行日志 数据表", description = "场景联动规则执行日志")
@TableName("device_scene_linkage_rule_log")
public class DeviceSceneLinkageRuleLog implements Serializable {
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty("主键id")
    @TableId(value = "id",type = IdType.INPUT)
    private Long id;

    @ApiModelProperty(name = "ruleId", value = "规则id")
    private Long ruleId;

    @ApiModelProperty(name = "projectId", value = "项目id")
    private Long projectId;

    @ApiModelProperty(name = "triggerProductKey", value = "触发设备的产品key")
    private String triggerProductKey;

    @ApiModelProperty(name = "triggerDeviceName", value = "触发设备的设备名称")
    private String triggerDeviceName;

    @ApiModelProperty(name = "triggerMode", value = "触发方式，1-设备触发，2-定时触发，3-手动触发")
    private Integer triggerMode;

    @ApiModelProperty(name = "triggerType", value = "触发类型 property设备属性，event设备事件，deviceStatusChange设备上下线触发")
    private String triggerType;

    @ApiModelProperty(name = "triggerRuleId", value = "触发规则，如果这条规则的执行是由另一个规则执行的则该字段有值")
    private Long triggerRuleId;

    @ApiModelProperty(name = "triggerStartTime", value = "执行开始时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date triggerStartTime;

    @ApiModelProperty(name = "triggerEndTime", value = "执行结束时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date triggerEndTime;

    @ApiModelProperty(name = "triggerContent", value = "触发当时触发器内容快照")
    private String triggerContent;

    @ApiModelProperty(name = "deviceContent", value = "设备触发规则时传输过来的内容快照")
    private String deviceContent;

    @ApiModelProperty(name = "status", value = "规则执行状态 0:执行中，1：执行成功，2：执行失败")
    private Integer status;

    @ApiModelProperty(name = "result", value = "规则执行结果描述")
    private String result;

}