using NIDAQmx.DAQmxEnum;

namespace NIDAQmx
{
    public class Trigger : BaseDevice
    {
        internal Trigger(DAQmxSession session, string deviceName) : base(session, deviceName)
        {
            AnlgTrigSupported = GetAnlgTrigSupported();
            DigTrigSupported = GetDigTrigSupported();
            TimeTrigSupported = GetTimeTrigSupported();
        }
        private bool GetAnlgTrigSupported()
        {
            uint val = 0;
            _Session.CheckResult(_Session.GetDelegate<Internal.Internal.DAQmxGetDevAnlgTrigSupported>()(DeviceName, ref val));
            return Convert.ToBoolean(val);
        }
        private bool GetDigTrigSupported()
        {
            uint val = 0;
            _Session.CheckResult(_Session.GetDelegate<Internal.Internal.DAQmxGetDevDigTrigSupported>()(DeviceName, ref val));
            return Convert.ToBoolean(val);
        }
        private bool GetTimeTrigSupported()
        {
            uint val = 0;
            _Session.CheckResult(_Session.GetDelegate<Internal.Internal.DAQmxGetDevTimeTrigSupported>()(DeviceName, ref val));
            return Convert.ToBoolean(val);
        }
        public bool AnlgTrigSupported { get; }
        public bool DigTrigSupported { get; }
        public bool TimeTrigSupported { get; }
        public override string ToString()
        {
            return $"{nameof(AnlgTrigSupported)};{AnlgTrigSupported},{nameof(DigTrigSupported)}:{DigTrigSupported},{nameof(TimeTrigSupported)}:{TimeTrigSupported}";
        }
    }
}
