using System;
using System.Text.RegularExpressions;
namespace Renci.SshNet
{
    /// 
    /// Specifies behavior for expected expression
    /// 
    public class ExpectAction
    {
        /// 
        /// Gets the expected regular expression.
        /// 
        public Regex Expect { get; private set; }
        /// 
        /// Gets the action to perform when expected expression is found.
        /// 
        public Action Action { get; private set; }
        /// 
        /// Initializes a new instance of the  class.
        /// 
        /// The expect regular expression.
        /// The action to perform.
        ///  or  is null.
        public ExpectAction(Regex expect, Action action)
        {
            if (expect == null)
                throw new ArgumentNullException("expect");
            if (action == null)
                throw new ArgumentNullException("action");
            this.Expect = expect;
            this.Action = action;
        }
        /// 
        /// Initializes a new instance of the  class.
        /// 
        /// The expect expression.
        /// The action to perform.
        ///  or  is null.
        public ExpectAction(string expect, Action action)
        {
            if (expect == null)
                throw new ArgumentNullException("expect");
            if (action == null)
                throw new ArgumentNullException("action");
            this.Expect = new Regex(Regex.Escape(expect));
            this.Action = action;
        }
    }
}