using System.Text.RegularExpressions;

namespace NotepadEnhanced.Refactexing
{
    /// <summary>
    /// Provides a set of preset Refactexes
    /// </summary>
    static class RefactexPresets
    {
        public static Refactex GetTrimWhiteSpace
        {
            get
            {
                const string NAME = "Trim White Space";
                const string DESCRIP = "Removes trailing and leading whitepace";
                const string PATTERN = @"(^\s+)|(\s+$)";
                return new Refactex(NAME, DESCRIP, PATTERN);
            }
        }

        public static Refactex GetBulletInserter
        {
            get
            {
                const string NAME = "Bullet Inserter";
                const string DESCRIP = "Inserts bullets at the start of each line (replaces line numbers)";
                const string PATTERN = @"^(?!•)(\d+\.)?";
                return new Refactex(NAME, DESCRIP, PATTERN, "•", RegexOptions.Multiline);
            }
        }

        public static Refactex SingleSpaceOnly
        {
            get
            {
                const string NAME = "Single Space Only";
                const string DESCRIP = "All whitespace is replaced by a single space";
                const string PATTERN = @"\s\s+";
                return new Refactex(NAME, DESCRIP, PATTERN, " ");
            }
        }

        public static Refactex RemoveNumberedList
        {
            get
            {
                const string NAME = "Remove Numbered List";
                const string DESCRIP = "Removes numbered lists";
                const string PATTERN = @"^\d+\.\s+";
                return new Refactex(NAME, DESCRIP, PATTERN, string.Empty, RegexOptions.Multiline);
            }
        }

        public static Refactex ReduceToDoubleNewlines
        {
            get
            {
                const string NAME = "Reduce To Double Newlines";
                const string DESCRIP = "Reduces multiple newlines to a double newline";
                return new Refactex(NAME, DESCRIP, @"(\n|\r){3,}", "\n\n");
            }
        }
    }
}
