﻿namespace letter_switcheroo_MyLib
{
    public class Word
    {
        private string word;
        
        internal Word(string word)
        {
            this.word = word;
        }
        
        /// <summary>
        ///     Switch a word using the specified algorithm.
        ///     Returns the switched word but the word is also modified in-place.
        /// </summary>
        public Word UsingThe(ISwitcherooAlgorithm algorithm)
        {
            if (this.word.Length > 2)
            {
                this.word = algorithm.Switch(this.word);
            }

            return this;
        }

        public override string ToString()
        {
            return this.word;
        }
    }
}