﻿using MessagePack;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace IoT3D.Framework
{
    public class myEquipItem
    {
        public myProxy_EquipItem EquipItem;
        public Dictionary<int, myProxy_YCItem> YCItemDict;
        public Dictionary<int, myProxy_YXItem> YXItemDict;
    }
    public class EquipItemBase
    {
        public string related_video { get; set; }
        public string ZiChanID { get; set; }
        public string PlanNo { get; set; }
        public string related_pic { get; set; }
        public int m_iEquipNo { get; set; }
        public bool m_Bufang { get; set; }
    }
    public class myProxy_YXItem : EquipItemBase
    {
        public int m_iYXNo { get; set; }
        public string m_YXNm { get; set; }
        public object m_YXValue { get; set; }
        public string m_YXState { get; set; }
        public string m_FullYXState { get; set; }
        public bool m_IsAlarm { get; set; }
        public bool m_bHasHistoryXcurve { get; set; }
    }
    public class myProxy_YCItem : EquipItemBase
    {
        public int m_iYCNo { get; set; }
        public string m_YCNm { get; set; }
        public string m_Unit { get; set; }
        public object m_YCValue { get; set; }
        public bool m_IsAlarm { get; set; }
        public string m_AdviceMsg { get; set; }
        public bool m_bHasHistoryCcurve { get; set; }

    }
    public class myProxy_EquipItem : EquipItemBase
    {
        public string m_EquipNm { get; set; }
        public EquipState m_State { get; set; }
    }
    //public class SetParm
    //{
    //    public int sta_n { get; set; }
    //    public int equip_no { get; set; }
    //    public int set_no { get; set; }
    //    public string  set_nm { get; set; }
    //    public string set_type { get; set; }
    //    public string main_instruction { get; set; }
    //    public string minor_instruction { get; set; }
    //    public string record { get; set; }
    //    public string action { get; set; }
    //    public string value { get; set; }
    //    public string canexecution { get; set; }
    //    public string VoiceKeys { get; set; }
    //    public string EnableVoice { get; set; }
    //    public string Reserve1 { get; set; }
    //    public string Reserve2 { get; set; }
    //    public string Reserve3 { get; set; }
    //    public int qr_equip_no { get; set; }

    //}
    [MessagePackObject]
    public class EquipItemData
    {
        private int ycyxNo;
        private string equipName;
        private bool isSelect;
        [Key(0)]
        public int YcyxNo { get => ycyxNo; set => ycyxNo = value; }
        [Key(1)]
        public string EquipName { get => equipName; set => equipName = value; }
        [Key(2)]
        public bool IsSelect { get => isSelect; set => isSelect = value; }
    }


    public enum EquipState
    {
        NoCommunication = 0,
        CommunicationOK = 1,
        HaveAlarm = 2,
        HaveSetParm = 3,
        Initial = 4,
        CheFang = 5,
        None
    }

    public class IoTEquipEventData
    {
        public int QueryCount { get; set; }
        [JsonProperty("Datas")]
        public List<IoTEquipEvent> Events { get; set; }
    }
    public class IoTEquipEvent
    {
        public int sta_n { get; set; }
        public int equip_no { get; set; }
        public int ycyx_no { get; set; }
        public int set_no { get; set; }
        public string ycyx_type { get; set; }
        public string gwEvent { get; set; }
        public DateTime time { get; set; }
        public string proc_rec { get; set; }
        public int alarmlevel { get; set; }
        public string GUID { get; set; }
        public int snapshotlevel { get; set; }
        public int alarmstate { get; set; }
        public string confirmname { get; set; }
        public DateTime confirmtime { get; set; }
        public string confirmremark { get; set; }
        public bool wubao { get; set; }
    }
    public enum IoTEquipEventType
    {
       // None = -1,
        YC_Event = 0,
        YX_Event = 1,
        Equip_Event = 2,
        SetParm_Event = 3,
        System_Event = 4
    }
}
