using NIDAQmx.DAQmxEnum;
using NIDAQmxConst;
using System.Security.AccessControl;

namespace NIDAQmx
{
    public class DOChannelConfig : BaseChannelConfig
    {
        internal DOChannelConfig(ChannelAttributeSession session) : base(session)
        {
            AttributeSession = session;
            LineStates = new LineStatesConfig(session);
            Overcurrent = new OvercurrentConfig(session);
        }
        internal override ChannelAttributeSession AttributeSession { get; }
        public LineStatesConfig LineStates { get; }
        public OvercurrentConfig Overcurrent { get; }
        public OutputDriveType OutputDriveType { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDOOutputDriveType,OutputDriveType>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDOOutputDriveType,OutputDriveType>(value); }
        public bool InvertLines { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDOInvertLines,bool>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDOInvertLines,bool>(value); }
        public uint NumLines=>AttributeSession.GetValue<Internal.DO.DAQmxGetDONumLines,uint>();
        public bool Tristate { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDOTristate,bool>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDOTristate,bool>(value); }
        public LogicFamily LogicFamily { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDOLogicFamily,LogicFamily>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDOLogicFamily,LogicFamily>(value); }

        public class LineStatesConfig : BaseChannelConfig
        {
            internal LineStatesConfig(ChannelAttributeSession session) : base(session)
            {
                AttributeSession = session;
            }
            internal override ChannelAttributeSession AttributeSession { get; }
            public LineStates StartState { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDOLineStatesStartState,LineStates>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDOLineStatesStartState,LineStates>(value); }
            public LineStates PausedState { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDOLineStatesPausedState,LineStates>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDOLineStatesPausedState,LineStates>(value); }
            public LineStates DoneState { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDOLineStatesDoneState,LineStates>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDOLineStatesDoneState,LineStates>(value); }
        }
        public class OvercurrentConfig:BaseChannelConfig
        {
            internal OvercurrentConfig(ChannelAttributeSession session) : base(session)
            {
                AttributeSession = session;
            }
            internal override ChannelAttributeSession AttributeSession { get; }
            public double Limit { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDOOvercurrentLimit,double>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDOOvercurrentLimit,double>(value); }
            public bool AutoReenable { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDOOvercurrentAutoReenable,bool>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDOOvercurrentAutoReenable,bool>(value); }
            public double ReenablePeriod { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDOOvercurrentReenablePeriod,double>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDOOvercurrentReenablePeriod,double>(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 GenerateOn GenerateOn { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDOGenerateOn,GenerateOn>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDOGenerateOn,GenerateOn>(value); }
                public bool UseOnlyOnBrdMem { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDOUseOnlyOnBrdMem,bool>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDOUseOnlyOnBrdMem,bool>(value); }
                public DataXferMech DataXferMech { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDODataXferMech,DataXferMech>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDODataXferMech,DataXferMech>(value); }
                public OutDataXferReqCond DataXferReqCond { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDODataXferReqCond,OutDataXferReqCond>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDODataXferReqCond,OutDataXferReqCond>(value); }
                public uint UsbXferReqSize { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDOUsbXferReqSize,uint>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDOUsbXferReqSize,uint>(value); }
                public uint UsbXferReqCount { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDOUsbXferReqCount,uint>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDOUsbXferReqCount,uint>(value); }
                public bool MemMapEnable { get => AttributeSession.GetValue<Internal.DO.DAQmxGetDOMemMapEnable,bool>(); set => AttributeSession.SetValue<Internal.DO.DAQmxSetDOMemMapEnable,bool>(value); }
            }

        }

    }
}
