using System;

namespace ZionSchematics.Models.SearchControlTypes
{
    [Serializable]
    public class SearchControlFactory
    {
        private const string Optional = "OPTIONAL";
        private const string Prohibited = "PROHIBITED";
        private const string Required = "REQUIRED";
        private const string Repeating = "REPEATING";

        public static ISearchControl construct(string type)
        {
            switch (type.ToUpper())
            {
                case Optional: return new OptionalElement();
                case Prohibited: return new ProhibitedElement();
                case Required: return new RequiredElement();
                case Repeating: return new RepeatingElement();
                default: return null;
            }
        }
    }
}
