using NIDAQmx.DAQmxEnum;
using NIDAQmxConst;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NIDAQmx
{
    public class DIChannelConfig : BaseChannelConfig
    {
        internal DIChannelConfig(ChannelAttributeSession session) : base(session)
        {
            AttributeSession = session;
            DigFltr = new DigFltrConfig(session);
            DigSync = new DigSyncConfig(session);
            GeneralProperties = new GeneralPropertiesConfig(session);
        }
        public DigFltrConfig DigFltr { get; }
        public DigSyncConfig DigSync { get; }
        public GeneralPropertiesConfig GeneralProperties { get; }
        internal override ChannelAttributeSession AttributeSession { get; }
        public bool InvertLines { get => AttributeSession.GetValue<Internal.DI.DAQmxGetDIInvertLines,bool>(); set => AttributeSession.SetValue<Internal.DI.DAQmxSetDIInvertLines,bool>(value); }
        public uint NumLines => AttributeSession.GetValue<Internal.DI.DAQmxGetDINumLines,uint>();
        public bool Tristate { get => AttributeSession.GetValue<Internal.DI.DAQmxGetDITristate,bool>(); set => AttributeSession.SetValue<Internal.DI.DAQmxSetDITristate,bool>(value); }
        public LogicFamily LogicFamily { get => AttributeSession.GetValue<Internal.DI.DAQmxGetDILogicFamily,LogicFamily>(); set => AttributeSession.SetValue<Internal.DI.DAQmxSetDILogicFamily,LogicFamily>(value); }


        public class DigFltrConfig:BaseChannelConfig
        {
            internal DigFltrConfig(ChannelAttributeSession session) : base(session)
            {
                AttributeSession = session;
            }
            internal override ChannelAttributeSession AttributeSession { get; }
            public bool Enable { get => AttributeSession.GetValue<Internal.DI.DAQmxGetDIDigFltrEnable,bool>(); set => AttributeSession.SetValue<Internal.DI.DAQmxSetDIDigFltrEnable,bool>(value); }
            public double MinPulseWidth { get => AttributeSession.GetValue<Internal.DI.DAQmxGetDIDigFltrMinPulseWidth,double>(); set => AttributeSession.SetValue<Internal.DI.DAQmxGetDIDigFltrMinPulseWidth,double>(value); }
            public bool EnableBusMode { get => AttributeSession.GetValue<Internal.DI.DAQmxGetDIDigFltrEnableBusMode,bool>(); set => AttributeSession.SetValue<Internal.DI.DAQmxSetDIDigFltrEnableBusMode,bool>(value); }
            public string TimebaseSrc { get => AttributeSession.GetValue<Internal.DI.DAQmxGetDIDigFltrTimebaseSrc>(); set => AttributeSession.SetValue<Internal.DI.DAQmxSetDIDigFltrTimebaseSrc>(value); }
            public double TimebaseRate { get => AttributeSession.GetValue<Internal.DI.DAQmxGetDIDigFltrTimebaseRate,double>(); set => AttributeSession.SetValue<Internal.DI.DAQmxSetDIDigFltrTimebaseRate,double>(value); }
        }
        public class DigSyncConfig:BaseChannelConfig
        {
            internal DigSyncConfig(ChannelAttributeSession session) : base(session)
            {
                AttributeSession = session;
            }
            internal override ChannelAttributeSession AttributeSession { get; }
            public bool Enable { get => AttributeSession.GetValue<Internal.DI.DAQmxGetDIDigSyncEnable,bool>(); set => AttributeSession.SetValue<Internal.DI.DAQmxSetDIDigSyncEnable,bool>(value); }

        }
        public class GeneralPropertiesConfig:BaseChannelConfig
        {
            internal GeneralPropertiesConfig(ChannelAttributeSession session) : base(session)
            {
                AttributeSession = session;
                Advanced = new AdvancedConfig(session);
            }
            public AdvancedConfig Advanced { get; }
            internal override ChannelAttributeSession AttributeSession { get; }

            public class AdvancedConfig:BaseChannelConfig
            {
                internal AdvancedConfig(ChannelAttributeSession session) : base(session)
                {
                    AttributeSession = session;
                }
                internal override ChannelAttributeSession AttributeSession { get; }
                public DataXferMech DataXferMech { get => AttributeSession.GetValue<Internal.DI.DAQmxGetDIDataXferMech,DataXferMech>(); set => AttributeSession.SetValue<Internal.DI.DAQmxSetDIDataXferMech,DataXferMech>(value); }
                public InputDataXferReqCond DataXferReqCond { get => AttributeSession.GetValue<Internal.DI.DAQmxGetDIDataXferReqCond,InputDataXferReqCond>(); set => AttributeSession.SetValue<Internal.DI.DAQmxSetDIDataXferReqCond,InputDataXferReqCond>(value); }
                public uint UsbXferReqSize { get => AttributeSession.GetValue<Internal.DI.DAQmxGetDIUsbXferReqSize,uint>(); set => AttributeSession.SetValue<Internal.DI.DAQmxSetDIUsbXferReqSize,uint>(value); }
                public uint UsbXferReqCount { get => AttributeSession.GetValue<Internal.DI.DAQmxGetDIUsbXferReqCount,uint>(); set => AttributeSession.SetValue<Internal.DI.DAQmxSetDIUsbXferReqCount,uint>(value); }
                public bool MemMapEnable { get => AttributeSession.GetValue<Internal.DI.DAQmxGetDIMemMapEnable,bool>(); set => AttributeSession.SetValue<Internal.DI.DAQmxSetDIMemMapEnable,bool>(value); }
                public GenerateOn AcquireOn { get => AttributeSession.GetValue<Internal.DI.DAQmxGetDIAcquireOn,GenerateOn>(); set => AttributeSession.SetValue<Internal.DI.DAQmxSetDIAcquireOn,GenerateOn>(value); }
            }

        }
    }

}
