namespace ZionSchematics.Models.SearchModes
{
    public class SearchModeFactory
    {
        private const string Constraint = "CONSTRAINT";
        private const string RegularExpression = "REGULAREXPRESSION";
        private const string Barcode = "BARCODE";
        private const string BetweenText = "BETWEENTEXT";
        private const string BetweenTextVertical = "BETWEENTEXTVERTICAL";
        private const string ConstantValue = "CONSTANTVALUE";
        private const string ValueVariable = "VALUEVARIABLE";
        private const string BestQuality = "BESTQUALITY";
        private const string FirstFound = "FIRSTFOUND";
        private const string MergeFields = "MERGEFIELDS";
        private const string Position = "POSITION";

        public static ISearchMode construct(string type)
        {
            switch (type.ToUpper())
            {
                case Constraint: return new Constraint();
                case RegularExpression: return new RegularExpression();
                case Barcode: return new Barcode();
                case BetweenText: return new BetweenText();
                case BetweenTextVertical: return new BetweenTextVertical();
                case ConstantValue: return new ConstantValue();
                case ValueVariable: return new ValueVariable();
                case BestQuality: return new BestQuality();
                case FirstFound: return new FirstFound();
                case MergeFields: return new MergeFields();
                case Position: return new Position();
                default: return null;
            }
        }
    }
}
