using Logger;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using TSMasterCAN;
using UIShare.UIViewModel;
using static UIShare.UIViewModel.ParameterVM;

namespace UIShare.GlobalVariable
{
    public class SystemConfig
    {
        [JsonIgnore]
        public string SystemPath { get; set; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ACP");
        [JsonIgnore]
        public string DLLFilePath { get; set; } = @"D:\ACP\指令\";
        [JsonIgnore]
        public string TSMasterName { get; set; } = "ACP测试上位机";
        public string SubProgramFilePath { get; set; } = @"D:\ACP\子程序\";
        public string Title { get; set; } = string.Empty;
        public string CurrentACPFile { get; set; }
        public int PerformanceLevel { get; set; } = 50;
        public string DefaultProgramFilePath { get; set; } = "";
        public string DefaultBLFFilePath { get; set; } = "";
        public string DefaultDBCFilePath { get; set; } = "";
        public ObservableCollection<DeviceInfoVM> DeviceList = new();
        public ObservableCollection<SharedParameter> SharedParameterList = new();
        public ObservableCollection<CANSignalConfig> ConfigurationList = new();
        public ObservableCollection<AutoDBCLoadItem> DBCAutoLoadList = new();
        public ObservableCollection<ValueLimitVM> ValueLimitList = new();
        [JsonIgnore]
        public ObservableCollection<MonitorChannelVM> Channels = new();
        /// <summary>
        /// 监测通道持久化配置列表（包含 Fingerprint、MethodName、IsDisplayed）
        /// </summary>
        public ObservableCollection<MonitorChannelConfig> MonitorChannels = new();
        public CAN CANFD = new();
        [JsonIgnore]
        public ObservableCollection<ParameterVM> ParameterList = new()
        {
            new ParameterVM
            {
                Category = ParameterCategory.Input,
                Type = typeof(int),
                Name = "台架序号",
                Value = 1,
                IsEditable=false
            },
            new ParameterVM
            {
                Category = ParameterCategory.Input,
                Type = typeof(int),
                Name = "CAN通道",
                Value = 0,
                IsEditable=false
            },
            new ParameterVM
            {
                Category = ParameterCategory.Input,
                Type = typeof(int),
                Name = "示波器通道1",
                Value = 0,
                IsEditable=false
            },
              new ParameterVM
            {
                Category = ParameterCategory.Input,
                Type = typeof(int),
                Name = "示波器通道2",
                Value = 0,
                IsEditable=false
            },
              new ParameterVM
            {
                Category = ParameterCategory.Input,
                Type = typeof(int),
                Name = "功率分析仪通道1",
                Value = 0,
                IsEditable=false
            },
                new ParameterVM
            {
                Category = ParameterCategory.Input,
                Type = typeof(int),
                Name = "功率分析仪通道2",
                Value = 0,
                IsEditable=false
            },
        };
//        public ObservableCollection<DeviceInfoVM> DeviceList { get; set; } = new()
//{
//    new DeviceInfoVM
//    {
//        DeviceName = "Chroma61800",
//        DeviceType = "Chroma61800",
//        Remark = "可编程交流电源",
//        ConnectionType = "Tcp",
//        IsEnabled = true,
//        IsConnected = false
//    },
//    new DeviceInfoVM
//    {
//        DeviceName = "DG1000Z",
//        DeviceType = "DG1000Z",
//        Remark = "信号发生器",
//        ConnectionType = "Tcp",
//        IsEnabled = true,
//        IsConnected = false
//    },
//    new DeviceInfoVM
//    {
//        DeviceName = "IT6015C",
//        DeviceType = "IT6015C",
//        Remark = "低压直流源载一体机",
//        ConnectionType = "Tcp",
//        IsEnabled = true,
//        IsConnected = false
//    },
//    new DeviceInfoVM
//    {
//        DeviceName = "IT6036C",
//        DeviceType = "IT6036C",
//        Remark = "高压直流源载一体机",
//        ConnectionType = "Tcp",
//        IsEnabled = true,
//        IsConnected = false
//    },
//    new DeviceInfoVM
//    {
//        DeviceName = "IT6720",
//        DeviceType = "IT6720",
//        Remark = "低压电源",
//        ConnectionType = "Tcp",
//        IsEnabled = true,
//        IsConnected = false
//    },
//    new DeviceInfoVM
//    {
//        DeviceName = "MCc06U",
//        DeviceType = "MCc06U",
//        Remark = "水冷机",
//        ConnectionType = "Tcp",
//        IsEnabled = true,
//        IsConnected = false
//    },
//    new DeviceInfoVM
//    {
//        DeviceName = "PW8001",
//        DeviceType = "PW8001",
//        Remark = "功率分析记录仪",
//        ConnectionType = "Tcp",
//        IsEnabled = true,
//        IsConnected = false
//    },
//    new DeviceInfoVM
//    {
//        DeviceName = "RLT1000",
//        DeviceType = "RLT1000",
//        Remark = "环境箱",
//        ConnectionType = "Tcp",
//        IsEnabled = true,
//        IsConnected = false
//    },
//    new DeviceInfoVM
//    {
//        DeviceName = "TektronixMSO",
//        DeviceType = "TektronixMSO",
//        Remark = "示波器",
//        ConnectionType = "Tcp",
//        IsEnabled = true,
//        IsConnected = false
//    },
//    new DeviceInfoVM
//    {
//        DeviceName = "IOBoard1",
//        DeviceType = "IOBoard",
//        Remark = "IO板卡1",
//        ConnectionType = "Tcp",
//        IsEnabled = true,
//        IsConnected = false
//    },
//    new DeviceInfoVM
//    {
//        DeviceName = "IOBoard2",
//        DeviceType = "IOBoard",
//        Remark = "IO板卡2",
//        ConnectionType = "Tcp",
//        IsEnabled = true,
//        IsConnected = false
//    },
//    new DeviceInfoVM
//    {
//        DeviceName = "IOBoard3",
//        DeviceType = "IOBoard",
//        Remark = "IO板卡3",
//        ConnectionType = "Tcp",
//        IsEnabled = true,
//        IsConnected = false
//    }
//};
    }
}
