using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using static ENVQuery;

/// <summary>
/// 告警-查询
/// </summary>
[AddComponentMenu("告警查询")]
public class TmsAlarmQuery : MonoBehaviour
{
    public List<TmsAlarmList> tmsAlarmLists;

    private async void Start()
    {
        //await initAsync("");
    }

    public async Task initAsync(string token)
    {
        var jsonResult = await CombineJSON.GetJson_POST("https://jsonplaceholder.typicode.com/posts", token);

        Root root = JsonConvert.DeserializeObject<Root>(jsonResult);

        tmsAlarmLists = root.data;
    }

    void Update()
    {
        
    }




    #region JSON
    [System.Serializable]
    public class TmsAlarmList
    {
        /// <summary>
        /// 告警ID
        /// </summary>
        public string alarmId ;
        /// <summary>
        /// 设备Id(告警对象Id)
        /// </summary>
        public string alarmDeviceId ;
        /// <summary>
        /// 告警类型
        /// </summary>
        public string alarmType ;
        /// <summary>
        /// 告警等级
        /// </summary>
        public string alarmLevel ;
        /// <summary>
        /// 告警时间
        /// </summary>
        public string alarmDate ;
        /// <summary>
        /// 告警描述
        /// </summary>
        public string alarmDescription ;
        /// <summary>
        /// 告警原因
        /// </summary>
        public string alarmReason ;
        /// <summary>
        /// 处理状态
        /// </summary>
        public string alarmHandleStatus ;
        /// <summary>
        /// 处理人员
        /// </summary>
        public string alarmHandlePerson ;
        /// <summary>
        /// 处理时间
        /// </summary>
        public string alarmHandleDate ;
    }

    public class Root
    {
        /// <summary>
        /// 
        /// </summary>
        public string code ;
        /// <summary>
        /// 操作成功
        /// </summary>
        public string message ;
        /// <summary>
        /// 
        /// </summary>
        public List<TmsAlarmList> data ;
        /// <summary>
        /// 
        /// </summary>
        public string serverTime ;
    }

    #endregion
}
