using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ProxyTunnel.Models
{
 
    public class CollectDtmfRules
    {
        #region Public Properties
        /// <summary>
        /// Should DTMF be detected
        /// </summary>
        public bool detectDtmf { get; set; }
        /// <summary>
        /// Should any previously detected digits be cleared before applying collection rules?
        /// </summary>
        public bool clearDigits { get; set; }

        /// <summary>
        /// Any DTMF characters to be used as termination indicators.  Typcially a single '#' character.  A single '@' character indicates ANY DTMF digit detected will terminate the collection.
        /// </summary>
        public string terminationCharacters { get; set; }

        /// <summary>
        /// If a terminator character is detected, should it be stripped out of the result?  (User hits 10#--should the result variable be '10' or '10#')
        /// </summary>
        public bool stripTerminator { get; set; }

        /// <summary>
        ///  /// TODO-- remove this if accounted for by "millisecondsToWaitForUserResponse"
        /// Overall timeout for collecting digits.  Should be larger than 'interDigitTimeoutMilliseconds'
        /// </summary>
        //public int timeoutMilliseconds { get; set; }

        /// <summary>
        /// If this amount of time passes between already pressed didgits, the collection completes.
        /// For example, 'On a scale of 1 to 10, how do you like X?'  A user presses 1, and may press a 0.  How long to wait before accepting 1 as the answer.
        /// </summary>
        public int interDigitTimeoutMilliseconds { get; set; }

        /// <summary>
        /// The maximum number of digits to collect a response, regardless of timeouts and terminationCharacters
        /// </summary>
        public int maxDigits { get; set; }
        #endregion

        #region Static Constructors for standard behaviors
        public static CollectDtmfRules SurveyResponseSettings()
        {
            CollectDtmfRules result = new CollectDtmfRules();
            result.clearDigits = true;
            result.detectDtmf = true;
            result.interDigitTimeoutMilliseconds = 3000;
            //result.timeoutMilliseconds = 10000;
            result.maxDigits = 10;
            result.stripTerminator = true;
            result.terminationCharacters = "#";

            return result;
        }

        #endregion
    }
}
