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

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

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

@Data
public class DeviceSceneLinkageRuleDetailConditionVo implements Serializable {
   @ApiModelProperty(name = "uri", value = "规则类型（执行条件类型：property-属性，event-事件，timeRange-时间范围）")
   private String uri;
   @ApiModelProperty(name = "params", value = "规则参数")
   private Params params;

   public String getCheckType(){
       return uri.substring(uri.lastIndexOf("/")+1,uri.length());
   }

   @Data
   public static class Params{
       @ApiModelProperty(name = "productKey", value = "产品")
       private String productKey;
       @ApiModelProperty(name = "deviceName", value = "设备")
       private String deviceName;
       @ApiModelProperty(name = "eventCode", value = "事件")
       private String eventCode;
       @ApiModelProperty(name = "propertyName", value = "参数")
       private String propertyName;
       @ApiModelProperty(name = "compareType", value = "对比类型")
       private String compareType;
       @ApiModelProperty(name = "compareValue", value = "对比值")
       private String compareValue;
       @ApiModelProperty(name = "propMode", value = "参数值类型int float...")
       private String propMode;
       @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
       @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
       @ApiModelProperty(name = "eventCode", value = "开始时间")
       private Date beginDate;
       @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
       @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
       @ApiModelProperty(name = "eventCode", value = "结束时间")
       private Date endDate;
   }

}
