using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;

namespace SlnMesnac.Config
{
    /// <summary>
    /// 系统配置
    /// </summary>
    public sealed class DebugConfig
    {
        private static IniHelper iniHelper = new IniHelper(System.Environment.CurrentDirectory + "/config/App.InI");


        private static readonly Lazy<DebugConfig> lazy = new Lazy<DebugConfig>(() => new DebugConfig());
        public static DebugConfig Instance
        {
            get
            {
                return lazy.Value;
            }
        }

        public DebugConfig()
        {

        }

        /// <summary>
        ///工位编号
        /// </summary>
        public string ProductLine
        {
            get { return iniHelper.IniReadValue("system", "ProductLine"); }
            set { iniHelper.IniWriteValue("system", "ProductLine", value); }
        }

        /// <summary>
        /// 海康扫码器--IP
        /// </summary>
        public string ScannerIP
        {
            get { return iniHelper.IniReadValue("system", "ScannerIP"); }
            set { iniHelper.IniWriteValue("system", "ScannerIP", value); }
        }

        /// <summary>
        /// 海康相机--IP
        /// </summary>
        public string CameraIP
        {
            get { return iniHelper.IniReadValue("system", "CameraIP"); }
            set { iniHelper.IniWriteValue("system", "CameraIP", value); }
        }

        /// <summary>
        /// 串口模块--IP
        /// </summary>
        public string SerialIP
        {
            get { return iniHelper.IniReadValue("system", "SerialIP"); }
            set { iniHelper.IniWriteValue("system", "SerialIP", value); }
        }

        /// <summary>
        /// 海康相机拍照存放路径
        /// </summary>
        public string CameraFilePath
        {
            get { return iniHelper.IniReadValue("system", "CameraFilePath"); }
            set { iniHelper.IniWriteValue("system", "CameraFilePath", value); }
        }

        /// <summary>
        /// 拍照延迟
        /// </summary>
        public string SleepStr
        {
            get { return iniHelper.IniReadValue("system", "Sleep"); }
            set { iniHelper.IniWriteValue("system", "Sleep", value); }
        }

        /// <summary>
        /// 读取照片延迟
        /// </summary>
        public string PictureSleep
        {
            get { return iniHelper.IniReadValue("system", "PictureSleep"); }
            set { iniHelper.IniWriteValue("system", "PictureSleep", value); }
        }

        /// <summary>
        /// 报警灯COM口
        /// </summary>
        public string Port
        {
            get { return iniHelper.IniReadValue("system", "ComPort"); }
            set { iniHelper.IniWriteValue("system", "ComPort", value); }
        }


        /// <summary>
        /// 灯光控制COM口
        /// </summary>
        public string LightPort
        {
            get { return iniHelper.IniReadValue("system", "LightPort"); }
            set { iniHelper.IniWriteValue("system", "LightPort", value); }
        }

        /// <summary>
        /// 灯光控制波特率
        /// </summary>
        public string LightBaudRate
        {
            get { return iniHelper.IniReadValue("system", "LightBaudRate"); }
            set { iniHelper.IniWriteValue("system", "LightBaudRate", value); }
        }


        /// <summary>
        /// 全局灯光亮度控制： 0-关闭 1-打开 ,关闭以后每个类型的灯光亮度单独控制
        /// </summary>
        public string FullLightControl
        {
            get { return iniHelper.IniReadValue("system", "Ch1"); }
            set { iniHelper.IniWriteValue("system", "Ch1", value); }
        }


        /// <summary>
        /// ch1灯光亮度 0-255
        /// </summary>
        public string Ch1
        {
            get { return iniHelper.IniReadValue("system", "Ch1"); }
            set { iniHelper.IniWriteValue("system", "Ch1", value); }
        }

        /// <summary>
        /// ch2灯光亮度 0-255
        /// </summary>
        public string Ch2
        {
            get { return iniHelper.IniReadValue("system", "Ch2"); }
            set { iniHelper.IniWriteValue("system", "Ch2", value); }
        }

        /// <summary>
        /// 照片及日志保存时间
        /// </summary>
        public string PictureSaveTime
        {
            get { return iniHelper.IniReadValue("system", "PictureSaveTime"); }
            set { iniHelper.IniWriteValue("system", "PictureSaveTime", value); }
        }

        /// <summary>
        /// PLC报警停线开关，0-报警不停线，1-报警停线
        /// </summary>
        public string PlcStopLineFlag
        {
            get { return iniHelper.IniReadValue("system", "PlcStopLineFlag"); }
            set { iniHelper.IniWriteValue("system", "PlcStopLineFlag", value); }
        }
    }
}
