using System.Collections.Generic;

namespace ZionExtractor.Controllers.LegworkMethods
{
    class MergeFields
    {
        public static List<ZionExtractor.Models.Hypothesis> Search(List<ZionVault.Binder.Output.Field> fields)
        {
            try
            {
                List<ZionExtractor.Models.Hypothesis> list = new List<ZionExtractor.Models.Hypothesis>();
                int index = 1;
               ZionExtractor.Models.Hypothesis Chosen = new ZionExtractor.Models.Hypothesis(string.Empty, null, 0);

                foreach (ZionVault.Binder.Output.Field field in fields)
                {
                    Chosen.Value += field.Value + " ";
                    Chosen.Value = Chosen.Value.Trim();
                    Chosen.Quality += (int)(Chosen.Quality * 100) / index;
                }

                list.Add(Chosen);
                return list;
            }
            catch
            {
                return new List<ZionExtractor.Models.Hypothesis>();
            }
        }
    }
}
