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

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.yuchen.saas.device.api.dto.NetAlarmDto;
import com.yuchen.saas.device.api.entity.NetAlarm;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
public class NetAlarmVo extends NetAlarm {

//    /**
//     * 客户设备id集合
//     */
//    private List<Long> clientDeviceIdList = new ArrayList<>();

    /**
     * 产品名称
     */
    @ApiModelProperty(name = "productName", value = "产品名称")
    private String productName;
    /**
     * 设备名称
     */
    @ApiModelProperty(name = "deviceAlias", value = "设备名称")
    private String deviceAlias;

    /**
     * 事件名称
     */
    @ApiModelProperty(name = "eventName", value = "事件名称")
    private String eventName;

//    /**
//     * 告警分类; 1-设备告警，2-事件告警，3-业务提醒
//     */
//    @ApiModelProperty(name = "category", value = "设备名称")
//    private String category;

    /**
     * 告警类型名称
     */
    @ApiModelProperty(name = "alarmTypeName", value = "告警类型名称")
    private String alarmTypeName;
    /**
     * 第三方名称
     */
    @ApiModelProperty(name = "thirdPartyName", value = "第三方名称")
    private String thirdPartyName;

    /**
     * 服务应用名称
     */
    @ApiModelProperty(name = "deviceAlias", value = "服务应用名称")
    private String serviceName;

    /**
     * 触发条件列表
     */
    @ApiModelProperty(name = "triggerConditionList", value = "触发条件列表")
    private List<NetAlarmDto.TriggerCondition> triggerConditionList;

    /**
     * 执行动作列表
     */
    @ApiModelProperty(name = "executeActionList", value = "执行动作列表")
    private List<NetAlarmDto.ExecuteAction> executeActionList;


    public List<NetAlarmDto.TriggerCondition> getTriggerConditionList() {
        JSONArray jsonArray = JSON.parseArray(this.getTriggerConditionJson());
        return jsonArray.toJavaList(NetAlarmDto.TriggerCondition.class);
    }

    public List<NetAlarmDto.ExecuteAction> getExecuteActionList() {
        JSONArray jsonArray = JSON.parseArray(this.getExecuteActionJson());
        return jsonArray.toJavaList(NetAlarmDto.ExecuteAction.class);
    }

}
