package com.fastbee.iot.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Setter;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;


/**
 * 场景设备对象 iot_scene_device
 *
 * @author zhuangpeng.li
 * @date 2024-11-13
 */

@ApiModel(value = "SceneDevice", description = "场景设备 iot_scene_device")
@Data
@TableName("iot_scene_device" )
public class SceneDevice implements Serializable{
    private static final long serialVersionUID=1L;

    /** 场景设备ID */
    @TableId(value = "scene_device_id", type = IdType.AUTO)
    @ApiModelProperty("场景设备ID")
    private Long sceneDeviceId;

    /** 设备编号（产品触发的没有设备编号） */
    @ApiModelProperty("设备编号")
    private String serialNumber;

    /** 产品ID */
    @ApiModelProperty("产品ID")
    private Long productId;

    /** 产品名称 */
    @ApiModelProperty("产品名称")
    private String productName;

    /** 触发源（1=设备触发，3=产品触发） */
    @ApiModelProperty("触发源")
    private Integer source;

    /** 场景ID */
    @ApiModelProperty("场景ID")
    private Long sceneId;

    /** 场景脚本ID */
    @ApiModelProperty("场景脚本ID")
    private String scriptId;

    /** 类型（2=触发器，3=执行动作） */
    @ApiModelProperty("类型")
    private Integer type;

    @Setter
    @TableField(exist = false)
    @ApiModelProperty("请求参数")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private Map<String, Object> params;

    public Map<String, Object> getParams(){
        if (params == null){
            params = new HashMap<>();
        }
        return params;
    }

}
